Python 3 Script to Find Area of Triangle Using Coordinates Given by User Full Tutorial For Beginners

Python 3 Script to Find Area of Triangle Using Coordinates Given by User Full Tutorial For Beginners

 

Welcome folks today in this post we will be calculating area of traingle from coordinates given by user as input in python application. All the full source code of the application is given below.

 

 

Get Started

 

 

In order to get started you need to make an app.py file and copy paste the following code

See also  Python Tkinter GUI to Convert GIF to BMP or Vice-Versa Converter Using Pillow Library Full Project For Beginners

 

app.py

 

 

a = float(input('Enter first side: '))
b = float(input('Enter second side: '))
c = float(input('Enter 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)

 

 

As you can see we are taking the coordinates of all three sides of triangle from user as input and then calculating the area of triangle as shown below

See also  Python 3 WxPython MineSweeper Game Clone Script GUI Desktop App Full Project For Beginners

 

python app.py

 

Leave a Reply