# This program calculates the perimeter and area of diffrent shapes print("Welcome to the Shape Calculator.") print("This program calculates the perimeter +or circumference.") print("and the area of a square, rectangle, or circle.") print("\nPlease choose one of the following shapes:") print("- Square") print("- Rectangle") print("- Circle") choice = input("Enter your choice: ").strip().lower() print("-" * 50) if choice == "square": print("You selected: Square") length = float(input("Enter the length of a side: ")) area = length ** 2 perimeter = 4 * length print(f"Perimeter of the square: {perimeter:.2f}") print(f"Area of the square: {area:.2f}") elif choice == "rectangle": print("You selected: Rectangle") length = float(input("Enter the length: ")) width = float(input("Enter the width: ")) area = length * width perimeter = 2 * (length + width) print(f"Perimeter of the rectangle: {perimeter:.2f}") print(f"Area of the rectangle: {area:.2f}") elif choice == "circle": print("You selected: Circle") radius = float(input("Enter the radius: ")) circumference = 2 * math.pi * radius area = math.pi * (radius ** 2) print(f"Circumference (perimeter) of the circle: {circumference:.2f}") print(f"Area of the circle: {area:.2f}") else: print("Invalid selection. Please run the program again and choose Square, Rectangle, or Circle.") print("-" * 50) print("Thank you for using the Shape Geometry Calculator. The program has now ended. Goodbye!") # Run the program if __name__ == "__main__": calculate_shape_properties()