top of page

Python Programming Help

Public·2 members

Calculate the area of triangle in python - Codersarts

Source Code:



import math
a = float(input('Enter dimension of first side: '))
b = float(input('Enter dimension of second side: '))
c = float(input('Enter dimension of third side: '))

# 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)

73 Views
bottom of page