Question: I NEED THIS PYTHON PROGRAM IN 30 MINUTES PLEASE The program: Write a program that generate random number (1-10) of rectangle objects of various dimension

I NEED THIS PYTHON PROGRAM IN 30 MINUTES PLEASE

The program:

Write a program that generate random number (1-10) of rectangle objects of various dimension and prints the rectangles and the total area of all the rectangles.

First, define the Rectangle class. A rectangle is defined by its height and width. It has compute_area method that returns the rectangles area.

Second, create an empty list and append the list with random rectangles with height and width ranging from 1 to 100.

Last, iterate through the list and total the area of all the rectangles and print the result as shown the sample run.

Sample run:

Number of rectangles is 9. [ 96 , 91 ] [ 24 , 29 ] [ 94 , 73 ] [ 61 , 94 ] [ 52 , 6 ] [ 69 , 77 ] [ 28 , 28 ] [ 39 , 1 ] [ 49 , 31 ]

Total area= 29995

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!