Python program to calculate trapezoid area

Views: 59   

Following program shows you how to calculate trapezoid area.
This program gets trapezoid base and height from user and calculates area and prints it using following formula
Area = (base1 + base2) X height /2

trapezoidBase1 = float(input("Please enter base1 of trapezoid:"))
trapezoidBase2 = float(input("Please enter base2 of trapezoid:"))
trapezoidHeight = float(input("Please enter height of trapezoid:"))
areaOfTrapezoid = (trapezoidBase1 + trapezoidBase2) * trapezoidHeight / 2
print("Area of trapezoid is: " , areaOfTrapezoid)


Please enter base1 of trapezoid: 12
Please enter base2 of trapezoid: 15
Please enter height of trapezoid: 18
Area of trapezoid is:  243.0
On By