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 can be provided before or after the code, or in the form of code comments within the code. For any descriptive type question, Your answer must be at least 150 words.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter5: Repetition Statements
Section5.5: A Closer Look: Loop Programming Techniques
Problem 12E: (Program) Write a program that tests the effectiveness of the rand() library function. Start by...
icon
Related questions
Question

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 can be provided before or after the code, or in the form of code comments within the code. For any descriptive type question, Your answer must be at least 150 words.

Expert Solution
Step 1

When a function is not working, there are three possibilities to consider:

  1. The function is not being called: In this case, the function is defined correctly, but it is not being called. This can happen if the function is not included in the main code or if there is an error in the code that is supposed to call the function.

  2. The function is being called, but not with the correct arguments: In this case, the function is being called, but the arguments passed to the function are not correct. This can happen if the number of arguments passed to the function is incorrect or if the data type of the arguments is not as expected by the function.

  3. The function is being called with correct arguments, but the function is not working as expected: In this case, the function is being called with the correct arguments, but the function is not producing the expected result. This can happen if the function has a logical error or if the function is not meeting its preconditions or postconditions.

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Fibonacci algorithm
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr