 # How do you find the Area of a Triangle in Python? We can calculate the area of a triangle in python using Heron’s formula.

where s is the semi perimeter of the triangle that is calculated by the given formula:

s= (a+b+c)/2

and a, b and c are the lengths of three sides of the triangle.

We can calculate the area of a triangle in python using Heron’s formula.

where s is the semi perimeter of the triangle that is calculated by the given formula:

s= (a+b+c)/2

and a, b and c are the lengths of three sides of the triangle.

Table of content
##### For example:
                    
# area of a triangle using python

a = 5

b = 6

c = 7

# calculate the semi-perimeter

s = (a+b+c) /2

# calculate the area

area_tri = (s*(s-a)(s-b)(s-c)) ** 0.5

print('The area of triangle is : %0.2f' %area_tri)


##### Output:

The area of the triangle is 14.70

#### Related Topics

Share with friends  Customize your course in 30 seconds

Which class are you in?

5th
6th
7th
8th
9th
10th
11th
12th
Get ready for all-new Live Classes!
Now learn Live with India's best teachers. Join courses with the best schedule and enjoy fun and interactive classes.  Ashhar Firdausi
IIT Roorkee
Biology  Dr. Nazma Shaik
VTU
Chemistry  Gaurav Tiwari
APJAKTU
Physics
Get Started
Customize your course in 30 seconds

Which class are you in?

No thanks.