# This program calculates the perimeter and area of different shapes print('This program calculates the perimeter and area of different shapes.. lets begin') shape = input('Choose a shape from square, triangle, parallelogram rectangle or circle ') if shape == 'square': print('square') side = float(input('Enter the length of a side ')) square_area = side **2 square_perimeter = side * 4 print(f'The perimeter of a square with a length of {side} is {square_perimeter} ' f' the area is {square_area}') elif shape == 'triangle': print('triangle') base = float(input('Enter the base of the triangle ')) height = float(input('Enter the height of the triangle ')) side_1 = float(input('Enter one of the sides ')) side_2 = float(input('Enter the other side ')) triangle_area = (base * height) / 2 triangle_perimeter = base + side_1 + side_2 print(f'The perimeter of a triangle with a side of {side_1} and height of {height} is {triangle_perimeter} ' f' the area is {triangle_area}') elif shape == 'parallelogram': print('parallelogram') base = float(input('Enter the length of the base ')) height = float(input('Enter the length of the height ')) side = float(input('Enter the length of the side ')) parallelogram_perimeter = (base + side) * 2 parallelogram_area = base * height print(f'The perimeter of a parallelogram with a base of {base} and height of {height} is {parallelogram_perimeter} ' f' the area is {parallelogram_area}') elif shape == 'rectangle': print('rectangle') base = float(input('Enter the length of the base ')) height = float(input('Enter the length of the height ')) rectangle_area = base * height rectangle_perimeter = (base + height) * 2 print(f'The perimeter of a rectangle with a base of {base} and height of {height} is {rectangle_perimeter} ' f' the area is {rectangle_area}') else: print('circle') radius = float(input('Enter the radius of your circle ')) circle_area = 3.16 * radius**2 circle_perimeter = 2 * 3.16 * radius print(f'The perimeter of a circle with a radius of {radius} is {circle_perimeter} ' f' the area is {circle_area}') print('The program has ended')