Debugging
Breaking a large program into smaller functions creates natural checkpoints for debugging.
If a function is not working, there are three possibilities to consider:
There is something wrong with the arguments the function is getting; a precondition is violated.
These are conditions that must be true before executing a function.
Outputs
In this example, the precondition is the denominator, it should not be zero. If this precondition is
violated, the function prints an error message and returns none.
Another possibility is that there is something wrong with the function; postcondition is violated
From the book “Think Python by Allen Downey, If the parameters look good, add a print statement
before each return statement this describes postcondition.
Outputs
There is something wrong with the return value or the way it is being used.
References:
https://greenteapress.com/thinkpython2/thinkpython2.pdf