#Question 6
import math
print("""
A - Rectangle
B - Triangle
C - Circle
""")
shape = input("Enter shape: ")
if shape.upper() == "A":
height = float(input("Enter height: "))
base = float(input("Enter base: "))
area = height * base
elif shape.upper() == "B":
height = float(input("Enter height: "))
base = float(input("Enter base: "))
area = 0.5 * height* base
elif shape.upper() == "C":
radius = int(input("Enter radius: "))
area = math.pi * radius ** 2
print("Area =", area)
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