Answer to Question #97517 in Python for Courtland Floyd

Question #97517
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.
1
Expert's answer
2019-10-29T16:15:20-0400
print('Please, enter sides lengths:')

# Getting sides lengths
a, b, c, d, e = map(float, (input('A = '), input('B = '), input('C = '), input('D = '), input('E = ')))

# Finding rectangle area
rect_area = a * b

# Finding triangle area
triang_height = (c**2 - (a / 2)**2)**0.5
triang_area = 0.5 * a * triang_height

# Sum area
area = rect_area + triang_area

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

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS