Section 6.9 of your textbook ("Debugging") lists three possibilities to consider if a function is not working.
Describe each possibility in your own words.
Define "precondition" and "postcondition" as part of your description.
1) Something wrong with the arguments the function is getting; a precondition is violated.
It indicates that either the argument is not corresponding to the perimeter or not returning the same as the variable or function. They arise a syntax error and Python parser is unable to understand a line of code.
2) Something wrong with the function; a postcondition is violated.
To me is a semantic error. If there is an error in your code, it will work successfully and run like a perfect code that will not create any error messages. However, your program will not do the right thing.
3) Something wrong with the return value or the way it is being used.
The error that occurs during the execution of code. In distinction, compile-time errorshappen while a program is being compiled. Usually indicates bugs in the program or problems due to trying to return value incorrectly are Runtimeerrors.
Comments
Leave a comment