logo image

Python program to calculate trapezoid circumference

37


Following program shows you how to calculate trapezoid circumference. This program gets trapezoid bases and sides from user and calculates circumference and prints it using following formula Circumference = base1 + base2 + side1 +side2

trapezoidBase1 = float(input("Please enter base1 of trapezoid:"))
trapezoidBase2 = float(input("Please enter base2 of trapezoid:"))
trapezoidSide1 = float(input("Please enter side1 of trapezoid:"))
trapezoidSide2 = float(input("Please enter side2 of trapezoid:"))
circumferenceOfTrapezoid = trapezoidBase1 + trapezoidBase2 + trapezoidSide1 + trapezoidSide2
print("Circumference of trapezoid is: " , circumferenceOfTrapezoid)

Output:

Please enter base1 of trapezoid: 22
Please enter base2 of trapezoid: 14
Please enter side1 of trapezoid: 18
Please enter side2 of trapezoid: 24
Circumference of trapezoid is:  78.0