Area Of Triangle In Python

Chapter: Python Last Updated: 14-09-2018 05:07:23 UTC

Program:

            /* ............... START ............... */
                
# Python program to find area of triangle - Example

a = 8
b = 10
c = 15

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

# Triangle area calculation
area = (s*(s-a)*(s-b)*(s-c)) ** 0.5

print('Area of Triangle : %0.2f' %area)
                /* ............... END ............... */
        

Output

Area of Triangle : 36.98

Notes:

  • In the above program first we will take the values of three sides and we will find semi-perimeter and store in variable s.
  • Next step we will calculate area using the formula and print the values using the print function in python.

Tags

Python program to find area of triangle

Similar Programs Chapter Last Updated
Python Variables Python 21-09-2018
Python String Contains Python 15-09-2018
String In Python Python 22-09-2018
Python Switch Statement Python 20-09-2018
Python Function Example Python 14-09-2018
Python If Statement Python 14-09-2018
Python Square Root Python 22-09-2018
Add Two Numbers In Python Python 13-09-2018
Python Comments Python 22-09-2018
Python Hello World Python 14-09-2018

1