[Solved]-Python Program Part 1 Rectangles Program Complete Rectangle Simulator Program Uses Four Fu Q37200894
Python Program
Part 1: Rectangles
For this program you will complete a “rectangle simulator”program that uses four functions you will write. The full programhas been written below – all you need to do is successfully writethe four functions described here. Refer to the IPO notation belowwhen writing these functions (note: you can just copy the IPOdirectly into your code to document your functions):
# function: compute_area_of_rectangle# input: length (integer) and width (integer)# processing: computes the area of the described rectangle# output: returns the area of the described rectangle (integer)# function: compute_perimeter_of_rectangle# input: length (integer) and width (integer)# processing: computes the perimeter of the described rectangle# output: returns the perimeter of the described rectangle (integer)# function: draw_rectangle# input: length (integer) and width (integer)# processing: constructs the rectangle using a series of “*” characters (see below for a sample 4 by 3 rectangle:)# ***# ***# ***# ***# output: returns the rectangle (string)
This next function is used to encapsulate an input validationloop — so you can get input and validate it all in one functioncall.
# function: get_input# input: a prompt to ask the user (String), a low value (integer) and a high value (integer)# processing: continually prompts the user for input, using the supplied prompt. if the user does# not enter an integer within the defined range the function will re-prompt them# output: returns the integer the user supplied (int)
Here is the code for the main body of your program. Once you’vewritten the above functions, paste this code into your Python fileand the program should run using your functions.
length = get_input(“Enter a length between 3 and 10”, 3, 10)width = get_input(“Enter a width between 3 and 10”, 3, 10)area = compute_area_of_rectangle(length, width)perim = compute_perimeter_of_rectangle(length, width)print (“Area:”, area, “; Perim:”, perim)rect = draw_rectangle(length, width)print (rect)
Note: Take a careful look at the IPOspecification for the draw_rectangle function. It is supposed toreturn a string, which is the “image” of the rectangle. You’re notsupposed to print within the function — instead you should returnthe fully composed string so the calling code can print it. This isgoing to be true for almost all functions I specify in this course,and is generally how you will use functions in programming. Almostalways, you’ll have functions that put together the information foroutput, and you will do the actual output somewhere else in theprogram.
Expert Answer
Answer to Python Program Part 1: Rectangles For this program you will complete a “rectangle simulator” program that uses four func… . . .
OR

