figura = "triangle" if figura == "circle": radio= int(input("Enter the radius of the circle:")) pi=3.14 area = pi*(radio**2) print("The area of the circle""is: ",area) elif figura == "square": lado = int(input("Enter the length of the side:")) area = lado*lado print("The area of the square with side",lado,"is: ",area) elif figura == "triangle": altura = int(input("Enter the height of the triangle:")) base = int(input("Enter the base of the triangle:")) area = (base*altura)/2 print("The area of the triangle with height",altura,"and base ",base, "is: ",area) elif figura == "rectangle": altura = int(input("Enter the height of the rectangle:")) base = int(input("Enter the base of the rectangle:")) area = base*altura print("The area of the rectangle with height",altura,"and base",base, "is: ",area) else: print("failure")
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter