import math def calculate_area(shape): if shape == "circle": radius = float(input("Enter the radius of the circle: ")) area = math.pi * radius ** 2 print("The area of the circle is:", area) elif shape == "rectangle": length = float(input("Enter the length of the rectangle: ")) width = float(input("Enter the width of the rectangle: ")) area = length * width print("The area of the rectangle is:", area) elif shape == "triangle": base = float(input("Enter the base of the triangle: ")) height = float(input("Enter the height of the triangle: ")) area = 0.5 * base * height print("The area of the triangle is:", area) else: print("Invalid shape! Please try again.") shape = input("Enter the shape (circle, rectangle, or triangle): ") calculate_area(shape)