# Title: Shapes Program # Author: Varun Merai # Date: 3/06/2025 # Version: Version 1 - first version, Version 1.1 - minor revisions, Version 2 - major revisions # Purpose: Lets the user calculate the area and perimeter of a shape import math print('Welcome to the perimeter and area calculator program') print('This program will calculate the perimeter and area of a shape... let\'s begin!') while True: shape = input('\nEnter "s" for square, "r" for rectangle, or "c" for circle: ') if shape == "s": print('You have selected Square') length = float(input('What is the length? ')) perimeter = 4 * length area = length ** 2 print(f'The perimeter of the square is {perimeter:.2f}') print(f'The area of the square is {area:.2f}') elif shape == "r": print('You have selected Rectangle') length = float(input('What is the length? ')) width = float(input('What is the width? ')) perimeter = 2 * (length + width) area = length * width print(f'The perimeter of the rectangle is {perimeter:.2f}') print(f'The area of the rectangle is {area:.2f}') elif shape == "c": print('You have selected Circle') radius = float(input('What is the radius? ')) circumference = 2 * math.pi * radius area = math.pi * radius ** 2 print(f'The circumference of the circle is {circumference:.2f}') print(f'The area of the circle is {area:.2f}') else: print('Please select one of these: "s" for square, "r" for rectangle, or "c" for circle.') choice = input("\nRun again? (y/n): ") if choice != 'y': print('The program has ended.') break