Python Program to calculate area of the triangle - Python for Data Analytics

Python Programs | Python Tricks | Solution for problems | Data Cleaning | Data Science

Python Program to calculate area of the triangle

Source Code:

# Python Program to find the area of triangle

a = 5
b = 6
c = 7


# calculate the semi-perimeter
s = (a + b + c) / 2

# calculate the area
area = (s*(s-a)*(s-b)*(s-c)) ** 0.5
print('The area of the triangle is %0.2f' %area)


Output

Screen-shot

No comments:

Post a Comment