University of the People**We aren't endorsed by this school
Course
COMP 1101
Subject
Computer Science
Date
Dec 20, 2024
Pages
2
Uploaded by ColonelRoseShark10
CS 1101 Discussion Forum Unit 4Welcome to the Unit 4 Discussion Forum!Section 6.9 Debugging of your textbook 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.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.The code and its output must be explained technically whenever asked. The explanation canbe provided before or after the code, or in the form of code comments within the code. For any descriptive type of question, Your answer must be at least 150 words.There is something wrong with the arguments the function is getting; a preconditionis violated.def quareroot(a)return(a*2)this function arguments are incorrect, as it is returning the number plus 2 and not the squareroot of given number, so the result is never what the user is expencting.There is something wrong with the function; a postcondition is violated.def countup(n):if n == 0: # Function will stop execute what n value is equal to zero, then return Blastoffprint('Blastoff!')else:print(n)countup(n + 1) # n+1 will allow countup n timeswhen the above function is executed, it will return error as it is not correctly idented, as youcan see in line 6, print statement is set below else condition.
There is something wrong with the return value or the way it is being used.def sumvalues(a, b):result = a-bprint(result)in the above function, the result should be the sum of a+b and the math operation is a-b, so the return value will not be the result of summing a+b