python function homework

 PART 1

 three possibilities to consider if a function is not working.

1. if preconditioned is violated

2. if postcondition is  violated

3. if wrong placement of return value

  • 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.

PART 2 

Invent your own function that does some useful computation of your choosing. Do not copy the function from somewhere else. 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.

Include all of the following in your Learning Journal:

  • 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.
Tags: No tags