In this python program, we will learn how to calculate the area of a trapezoid.
What is Trapezoid?
A trapezoid is a quadrilateral with exactly one pair of parallel sides.
Area of the Trapezoid = 0.5 * (base1 + base2) * height
Median of the Trapezoid = 0.5 * (base1 + base2)
Here is the source code of the program to find the area of a trapezoid.
# Python Program to Calculate the Area of a Trapezoid
# Take the Input from the User
base1 = float(input("Enter the First Base of a Trapezoid: "))
base2 = float(input("Enter the Second Base of a Trapezoid: "))
height = float(input("Enter the Height of a Trapezoid: "))
# calculate the area
Area = 0.5 * (base1 + base2) * height
# calculate the Median
Median = 0.5 * (base1 + base2)
# Print the Output
print("\n Area of a Trapezium = %.2f " %Area)
print(" Median of a Trapezium = %.2f " %Median)
Enter the First Base of a Trapezoid: 52
Enter the Second Base of a Trapezoid: 23
Enter the Height of a Trapezoid: 45
Area of a Trapezium = 1687.50
Median of a Trapezium = 37.50
Comments