You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Write a function called calculate_area that takes base and height as an input and returns and area of a triangle. Equation of an area of a triangle is,
2
+
# area = (1/2)*base*height
3
+
4
+
defcalculate_area(base,height):
5
+
area= (1/2) *base*height
6
+
7
+
returnarea
8
+
9
+
10
+
area_of_a_traingle=calculate_area(5,6)
11
+
print("The area of the triangle is", area_of_a_traingle)
# Modify above function to take third parameter shape type. It can be either "triangle" or "rectangle". Based on shape type it will calculate area. Equation of rectangle's area is,
0 commit comments