Breaking a large program into smaller functions creates natural checkpoints for debugging.If a function is not working,
Question:
Breaking a large program into smaller functions creates natural checkpoints for debugging.If a function is not working, there are there possibilities to consider:
i) There is something wrong with the arguments the function is getting; a precondition is volataed.
ii) There is something wrong with the function; a post condition is violated.
iii) There is something wrong with the return value or the way it is being used.
- Describe each possibility in your own words.
- Define "precondition" and "post condition" as part of your description.
- Create your own example of each possibility in Python code. List the code for each example, along with sample output from trying to run it.
question 2...
Invent your own function that does some useful computation of your choosing. Use incremental development, and record each stage of the development process as you go. Finally, print output that demonstrates that the function works as you intended.
- An explanation of each stage of development, including code and any test input and output.
- The output of three calls to your function with different arguments.
Data Analysis and Decision Making
ISBN: 978-0538476126
4th edition
Authors: Christian Albright, Wayne Winston, Christopher Zappe