How Do I Understand How To Refactor Code In To Functions For Future Use
I am taking a class using Python Crash Course Text. The class was supposed to be in person but has moved to online. I am confused with the following assignment and would like to kn
Solution 1:
The assignment is simple, instead of writing the whole logic without using functions (as it is written now) you need to separate the code into functions.
should be something like this:
defhas_100():
"""Identifies if anyone scored a 100"""# your code heredefprint_top_grades():
"""print the top n grades in the list in descending order"""# your code heredefmain():
"""Here you will write the execution of the program
reusing the functions above according to the task assigned"""# your code here# This is used to execute our file when you call 'python file.py' in your # terminalif __name__ == '__main__':
main()
Add the parameters you need to the functions (but not to the main()) to fulfil the task of each one.
Post a Comment for "How Do I Understand How To Refactor Code In To Functions For Future Use"