File tree 2 files changed +28
-0
lines changed
2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change
1
+ ## Why am I doing this
2
+ I am a software engineering student that just started learning GitHub and want to familiar with the GitHub Contribution Function
3
+
4
+ ## Description
5
+ This is a simple program that calculate the area of the triangle
6
+
7
+ ## How to run
8
+ Open a terminal in the folder where script is located and run the following command:
9
+
10
+ ``` sh
11
+ python TriangleCalculator.py
12
+ ```
13
+
14
+ Then input every side of the triangle and it will output the area of the triangle :)
15
+
16
+ ## Author
17
+ Benny Kwan
Original file line number Diff line number Diff line change
1
+ s1 = float (input ('Enter the first side of the triangle: ' ))
2
+ s2 = float (input ('Enter the second side of the triangle: ' ))
3
+ s3 = float (input ('Enter the third side of the triangle: ' ))
4
+
5
+ #Calculate the semi-perimeter
6
+ sp = (s1 + s2 + s3 )/ 2
7
+
8
+ #Calculate the area
9
+ area = (sp * (sp - s1 )* (sp - s2 )* (sp - s3 ))** 0.5
10
+
11
+ print ('The area of the triangle is %0.4f' % area )
You can’t perform that action at this time.
0 commit comments