In this post, you will learn how to calculate the area of a triangle in python and below is the video format of the post, check it out ????????
Python program to find area of a triangle
To find the area of a triangle then you should use the below formula
First, We calculate the semi perimeter and the formula will be ????????
s = (a + b + c) / 2
Then, We calculate the areas of the triangle ????????
area = (s(s-a)(s-b)*(s-c))
Before getting to the code you need to know about;
So, Below is the source code of the area of a triangle and the user should enter the values manually.
Firstly we have added three variables and gave three values for it and then calculated for semi perimeter.
Then finally calculated the area and then print the value.
If you want the user to ask the input value the use the input() function. Below is the source code of that.
Below is a run button that will allow you to run and check the program. I hope now you know how to calculate the area of triangles in python.
Also Read: Square root in python
Also Read: Logical operator in python full tutorial