-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDay5.py
21 lines (20 loc) · 1005 Bytes
/
Day5.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#TriangeTypechecker
# Prompt the user to enter the lengths of the three sides of the triangle
side1 = float(input("Enter the length of the first side: "))
side2 = float(input("Enter the length of the second side: "))
side3 = float(input("Enter the length of the third side: "))
# Check if the given sides can form a triangle using the triangle inequality theorem
if (side1 + side2 > side3) and (side1 + side3 > side2) and (side2 + side3 > side1):
# If the sides can form a triangle, determine the type of triangle
if side1 == side2 == side3:
# All sides are equal
print("The triangle is equilateral.")
elif side1 == side2 or side1 == side3 or side2 == side3:
# Exactly two sides are equal
print("The triangle is isosceles.")
else:
# No sides are equal
print("The triangle is scalene.")
else:
# If the sides cannot form a triangle, print an appropriate message
print("The given lengths cannot form a triangle.")