Q. Write a function called calculate_area() that takes base and height as input arguments and returns area of a triangle as an output. The formula used is:


Triangle Area = 1/2*base*height


Answer =


def calculate_area(x , y) :
    return 1 / 2 * x * y
base = float(input("Enter the Base of triangle : -"))
height = float (input ("Enter the Height of triangle : - "))
print ("Area of Triangle is : - ", calculate_area(base , height))


Output :-

Enter the Base of triangle : -6
Enter the Height of triangle : - 9
Area of Triangle is : -  27.0

>>> 

Enter the Base of triangle : -15.68
Enter the Height of triangle : - 13.55
Area of Triangle is : -  106.232

>>>

3 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post