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
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.
Step by Step Solution
3.39 Rating (152 Votes )
There are 3 Steps involved in it
ANSWER To rule out the first possibility you can add a print statement at the beginning of the function and display the values of the parameters and maybe their types Or you can write code that checks ... View full answer
Get step-by-step solutions from verified subject matter experts
