попробуйте это, может быть, это может помочь вам:
import math
import time
def calculate():
shapearea = 0
pi = 3.14159
print("Select shape\n1.Square\n2.Circle\n3.Triangle")
shape = input("Enter shape(Square/Circle/Triangle):")
if shape == "square":
sideval = int(input("Enter side value of the shape:"))
print("Calculating...")
#time.sleep(2)
shapearea = shapearea +(sideval ** 2)
elif shape == "circle":
circleradius = int(input("Enter radius value of the circle:"))
print("Calculating...")
#time.sleep(2)
shapearea = shapearea +(pi * circleradius **2)
elif shape == "triangle":
height = int(input("Enter the height of the shape:"))
base = int(input("Enter the base of the shape:"))
print("Calculating...")
#time.sleep(2)
shapearea = shapearea +(base*height/2)
else:
print("The given shape is invalid, give a valid shape to calculate the area")
print ("The area of the chosen shape is " "%.2f" % shapearea)
calculate()
while input("Do you want to continue?(Y/N)") == "Y":
calculate()
print("exiting from program...")