Question: I NEED A CODE FOT THIS WRITTEN IN PYTHON. (I'm running this program in IDLE 3.6) (RESULTS SHOULD DISPLAY THIS) Enter the length of the

I NEED A CODE FOT THIS WRITTEN IN PYTHON. (I'm running this program in IDLE 3.6)

I NEED A CODE FOT THIS WRITTEN IN PYTHON. (I'm running this

(RESULTS SHOULD DISPLAY THIS)

Enter the length of the rectangle: 4

Enter the width of the rectangle: 2

A rectangle with a length of 4.0 units, and a width of 2.0 units has the following area, perimeter, and hypotenuse:

Area: 8.00

Perimeter: 12.00

Hypotenuse: 4.47

1. Create a module called rectangle with the following: Import the math module Define the following functions. Each one should have two parameters, length and width a. b. i. An area function to calculate the area of a rectangle. 1. area length width 2. returns the area ii. A perimeter function to calculate the perimeter of the rectangle. 2. Returns the perimeter iii. 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. (Hint: loop) In the main function call the following functions: a. b. c. 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 output

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!