Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I NEED THIS WRITTEN IN PYTHON 1. Create a module called rectangle with the following: a. Import the math module b. Define the following functions.
I NEED THIS WRITTEN IN PYTHON
1. Create a module called rectangle with the following: a. Import the math module b. Define the following functions. Each one should have two parameters, length and width. i. An area function to calculate the area of a rectangle. 1. area length *width 2. returns the area A perimeter function to calculate the perimeter of the rectangle. 2*(length+ width) or (2 *length)+(2 * width) ii. 1. ii. A hypotenuse function to calculate the hypotenuse of the rectangle cut diagonally 1. 2. Use the math.hypot function to calculate the hypotenuse Return the hypotenuse 2. Create a program called rectangleData with the following functionality: It should import the rectangle module In the main function, prompt for the length and width of a rectangle (separately). Input Validation Issue an appropriate error message if the values are invalid and prompt again for valid numbers to be entered. Length and width must be greater than zero. a. b. c. In the main function call the following functions: i. rectangle.area (from the rectangle module) ii. rectangle.perimeter (from the rectangle module) ii. rectangle.hypotenuse (from the rectangle module) d. Display the results of the rectangle function calls - See below for test data and outputStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started