For this lab you will find the area of an irregularly shaped room with the shape as shown above. Ask the user to enter the values for sides A, B, C, D, and E and print out the total room area. Remember the formula for finding the area of a rectangle is length * width and the area of a right triangle is 0.5 * the base * height. Please note the final area should be in decimal format.

Respuesta :

Answer:

Following are the code to this question:

print("Enter sides length:")#print message

a,b,c,d,e = map(float,(input('A = '),input('B = '),input('C = '),input('D = '),input('E = ')))#defining variable for input value

r_area= a*b#defining a variable rect_area to calculate rectangle area  

t_height=(c**2-(a/2)**2)**0.5#defining variable t_height to calculate trangle height

t_area=0.5*a*t_height#defining variable t_area to calculate trangle area

room_area = r_area + t_area#defining variable to room_area to calculate room area

print('Total room area: %f' % room_area)#print area

Output:

Enter sides length:

A = 3

B = 4

C = 5

D = 3

E = 5

Total room area: 19.154544

Explanation:

In the above-given code five variable "a,b,c,d, and e" is declared, that uses the map method to input value from the user-end, and in the next step, "r_area, t_height, and t_area" is declared that calculate the area value and at the last room_area variable is declared that use the above-defined area variable to add all value and print the room area value.