CBSE Class 11 Computer Science
Question 41 of 63
Introduction to Python Modules — Question 10
Back to all questions# calculate_area.py
def area(base, height):
area = (1/2) * base * height
return area# triangle.py
from calculate_area import 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: 20
Area of the triangle: 100.0