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 user-defined function that takes three inputs and returns one output:
Input: the left bound (-1 in the example). No default value.
Input: the right bound (2 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 try-except clause. However, the program should not error should a mode that is different from "Rectangle" or "Trapezoid" be provided.
The main program (i.e., outside of the function) one-by-one asks the user for these three inputs and calls the user-defined 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: -1
Input the right bound: 2
Enter the mode, either 'Rectangle' or 'Trapezoid': Rectangle
18.0
-------------------------------------------
Input the left bound: -1
Input the right bound: 2
Enter the mode, either 'Rectangle' or 'Trapezoid': Trapezoid
13.5
-----------------------------------------------
Input the left bound: -1
Input the right bound: 2
Enter the mode, either 'Rectangle' or 'Trapezoid': rectangle
Warning: Mode not recognized. Returning zero area.
0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!