Question: in python spyder Your program will again approximate the area under the function using either a single rectangle or a single trapezoid. However, your program
in python spyder
Your program will again approximate the area under the function using either a single rectangle or a single trapezoid. However, your program should do this in a userdefined function that takes three inputs and returns one output:
Input: the left bound in the example No default value.
Input: the right bound in the example No default value.
Input: the mode either "Rectangle" or "Trapezoid" The default value is "Rectangle."
Output: the area
Your function does not need a tryexcept clause. However, the program should not error should a mode that is different from "Rectangle" or "Trapezoid" be provided.
The main program ie outside of the function onebyone asks the user for these three inputs and calls the userdefined function with them. The output value is returned to the main program when it is finally printed. Here are three example runs:
Input the left bound:
Input the right bound:
Enter the mode, either 'Rectangle' or 'Trapezoid': Rectangle
Input the left bound:
Input the right bound:
Enter the mode, either 'Rectangle' or 'Trapezoid': Trapezoid
Input the left bound:
Input the right bound:
Enter the mode, either 'Rectangle' or 'Trapezoid': rectangle
Warning: Mode not recognized. Returning zero area.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
