Python program to find area of triangle || with 2 easy examples

Python program to find area of triangle

Python program to find area of triangle

In this python program, we will find the area of a triangle.

Example 1:-

If Triangle is a Right Angle Triangle  

Python program to find area of triangle
#python program to find area of triangle

perpendicular=5
base=7
area= (perpendicular * base) / 2
print(‘area of right angle triangle = ‘,area)

Output

area of right angle triangle = 17.5

Example 2:-

If Triangle is not a right angle and the sizes of the sides are different then

Python program to find area of triangle

#python program to find area of triangle

a=10
b=15
c=12
s=(a + b + c) / 2
area = (s * (s-a) * (s-b) * (s-c) )** 0.5
print(‘area of triangle = ‘,area)

Output

area of triangle = 59.81168364124187

If you like my post please share it with your friends by simply clicking the below social media button, and Don’t forget to comment so we will update ourselves.

Share in a Single Click

Leave a Reply

Your email address will not be published. Required fields are marked *