Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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 output

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Excel As Your Database

Authors: Paul Cornell

1st Edition

1590597516, 978-1590597514

More Books

Students also viewed these Databases questions

Question

What is the environment we are trying to create?

Answered: 1 week ago

Question

How can we visually describe our goals?

Answered: 1 week ago