Common Computer Science References
Taking a chunk of code and removing it and placing it in a function is a great way to create modularity in your code. You isolate a portion of the code and can ensure it is working and then not have to worry about it.
Go back to your Assignment #2. Re-create that program that lets the user enter in the required dimensions and then calculates some result. You will do the exact same calculation!
The 3 caveats are:
You must pass the needed values into a function to calculate the value and then have the function return the result
Your main program (not the function) must ensure valid input and not crash if invalid input is given but warn the user and let them try again
You MUST do the same formula that you chose previously in assignment #2!
The pseudocode and flowchart are only for the function
If you are not sure on any part of the problem, just ask me and I will give you additional information.
I can get a bonus? Yes you can!
If you complete just the above part of the assignment in Python, you will be marked out of 3+. You will be marked out of 4+ if you do the programming in C as well.