# this program calculates the area and perimeter of different shapes V1 import math while True: shape = input('What is your shape — square, rectangle, or circle? ').lower() # check user input if shape == 'square': square_side = float(input('What is the length of the side of your square? ')) square_perimeter = square_side * 4 square_area = square_side ** 2 print(f'The perimeter of your square is {square_perimeter}') print(f'The area of your square is {square_area}') elif shape == 'rectangle': rectangle_height = float(input('What is the height of your rectangle? ')) rectangle_width = float(input('What is the width of your rectangle? ')) rectangle_perimeter = 2 * (rectangle_height + rectangle_width) rectangle_area = rectangle_height * rectangle_width print(f'The perimeter of your rectangle is {rectangle_perimeter}') print(f'The area of your rectangle is {rectangle_area}') elif shape == 'circle': radius = float(input('What is the radius of your circle? ')) circle_circumference = 2 * math.pi * radius circle_area = math.pi * (radius ** 2) print(f'The circumference of your circle is {circle_circumference:.2f}') print(f'The area of your circle is {circle_area:.2f}') else: print('Invalid shape! Please choose square, rectangle, or circle.\n') continue while True: other=input('Would you like to input another shape? (yes/no)? ').lower() if other == 'yes': break elif other == 'no': print('thank you') exit() else: print('Invalid input. Please enter "yes" or "no".')