CBSE Class 11 Computer Science
Question 57 of 98
Python Programming Fundamentals — Question 19
Back to all questions 19
Question Write a function called calculate_area() that takes base and height as an input argument and returns an area of a triangle as an output. The formula used is:
Area of a Triangle = ½*base*height
def calculate_area(base, height):
area = (1/2) * base * height
return area
base_value = int(input("Enter the base value: "))
height_value = int(input("Enter the height value: "))
triangle_area = calculate_area(base_value, height_value)
print("Area of the triangle:", triangle_area)Enter the base value: 10
Enter the height value: 5
Area of the triangle: 25.0