ENGG1003_Lab08_PythonBasics_2425T1
ENGG1003_Lab08_PythonBasics_2425T1
Sample Output 1
Image source:
https://www.cuemath.com/geometry/types-of-triangle/
Task 2 – Example Codes
Task 1 - Input and output of the Task 1 - Input and output of the
angles of a triangle angles of a triangle
a is 50 a is 120
b is 55 b is 20
c is 75 c is 40
Image source:
https://www.cuemath.com/geometry/types-of-triangle/
Task 3 – Sample Outputs
Task 1 - Input and output of the angles Task 1 - Input and output of the angles
of a triangle of a triangle
a is 60 a is 30
b is 60 b is 30
c is 60 c is 120
y
In Task 4, check if it is
a Right Triangle.
If it is not a Right
Triangle, alert the user
and stop the
execution.
Bonus Task 4 – Pythagoras
Theorem
If it is a Right triangle,
a. input the length of the
shorter arm of the right
angle (e.g. x),
z
x
b. determine the length of
another arm of the right
angle (e.g. y) by
trigonometric function with y
math module, and
c. determine the length of
the hypotenuse of a right
triangle (e.g. z) by the
Pythagoras Theorem
Output all sides line-by-line
as shown in the sample
outputs
Task 4 - Notes
Task 1 - Input and output of the Task 1 - Input and output of the
angles of a triangle angles of a triangle
What is the angle a? 45 What is the angle a? 30
What is the angle b? 45 What is the angle b? 60
a is 45 a is 30
b is 45 b is 60
c is 90 c is 90
Task 1 - Input and output of the Task 1 - Input and output of the
angles of a triangle angles of a triangle
What is the angle a? 90 What is the angle a? 20
What is the angle b? 60 What is the angle b? 20
a is 90 a is 20
b is 60 b is 20
c is 30 c is 140