# Title: Shapes Program # Author: Josh # Date: 12 November # Version: 1 # Purpose: Calculate the area and perimeter of shapes import math print("Welcome to the Shapes Program") print("This program calculates the area and perimeter of shapes") again = "yes" while again == "yes": shape = input("Choose square, rectangle or circle: ").strip().lower() if shape == "square": length = float(input("Enter the length: ")) perimeter = length * 4 area = length ** 2 elif shape == "rectangle": length = float(input("Enter the length: ")) width = float(input("Enter the width: ")) perimeter = 2 * (length + width) area = length * width elif shape == "circle": radius = float(input("Enter the radius: ")) perimeter = 2 * math.pi * radius area = math.pi * radius ** 2 else: print("Invalid shape") continue print("Shape:", shape) print("Perimeter/Circumference:", round(perimeter, 2)) print("Area:", round(area, 2)) again = input("Would you like another shape? yes or no: ").strip().lower() print("The program has ended")