# Title: Shape Calculator # Author: Lucca Asbury # Date: 3/06/2025 # Version: 1.0 #Purpose: Calculate the perimeter and area of a shape import math def calculate_square(): length = float(input("Enter the length of the square: ")) perimeter = round(4 * length,2) area = round(length ** 2,2) print(f"\nShape: Square") print(f"Perimeter: {perimeter} meters") print(f"Area: {area}\n") def calculate_rectangle(): length = float(input("Enter the length of the rectangle: ")) width = float(input("Enter the width of the rectangle: ")) perimeter = round(2 * (length + width),2) area = round(length * width,2) print(f"\nShape: Rectangle") print(f"Perimeter: {perimeter} maters") print(f"Area: {area}\n") def calculate_circle(): radius = float(input("Enter the radius of the circle: ")) circumference = round(2 * math.pi * radius,2) area = round(math.pi * (radius ** 2),2) print(f"\nShape: Circle") print(f"Circumference: {circumference}") print(f"Area: {area}\n") def main(): while True: shape = input("Choose a shape (s for square, r for rectangle or c for circle): ").strip().lower() if shape == "s": calculate_square() elif shape == "r": calculate_rectangle() elif shape == "c": calculate_circle() else: print("Invalid shape. Please enter 'square', 'rectangle', or 'circle'.") continue again = input("Would you like to calculate another shape? (yes/no): ").strip().lower() if again != 'yes': print("Thank you for using Lucca Asburys shape calculator!") break if __name__ == "__main__": main()