Untitled
unknown
plain_text
3 years ago
1.3 kB
11
Indexable
def area_triangle():
base = int(input("Enter the base: "))
height = int(input("Enter the height: "))
area = base * height * 0.5
print("The area is: " , area)
# area_triangle()
def area_square():
side = int(input("Enter side: "))
area = side * side
print("The area of the square is: " , area)
# area_square()
def rectangle():
base = int(input("Enter the base: "))
height = int(input("Enter the height: "))
area = base * height
perimeter = base * 2 + height * 2
print("The area of the rectangle is: ", area)
print("The perimeter of the rectangle is: ", perimeter)
# rectangle()
def area_circle():
radius = int(input("Enter the radius: "))
perimeter = radius * 2 * 3.14
area = radius * radius * 3.14
print("The area of the circle is: ", area)
print("The perimeter of the circle: ", perimeter)
# area_circle()
def shapes():
choice = input("""\nEnter 1 for triangle\nEnter 2 for square\nEnter 3 for circle\nEnter 4 for rectangle\n""")
if choice == "1":
area_triangle()
elif choice == "2":
area_square()
elif choice == "3":
area_circle()
elif choice == "4":
rectangle()
else:
print("bro outta range lah u")
shapes()Editor is loading...