The code is given in the explanation section.
Explanation:
def areacalcpy():
_input_ = input("Enter the shape that you wish to calculate the area: ")
shapearea = 0
pieval = 3.14
if _input_ == "Square":
sideval = int(input("Enter side value of the shape: "))
shapearea = shapearea + (sideval ** 2)
elif _input_ == "Circle":
circleradius = int(input("Enter radius value of the circle: "))
shapearea = shapearea + (2 * pieval * circleradius)
else:
print ("The given shape is invalid, give a valid shape to calculate area")
print ("%.2f" % shapearea)
areacalcpy()
The given code can calculate the area for both the shapes circle and square.
Similarly the area can be calculated for triangle and rectangle.