-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhm4.py
More file actions
38 lines (30 loc) · 1.47 KB
/
Copy pathhm4.py
File metadata and controls
38 lines (30 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
print("*********************\nIf you want to classify a triangle enter 1\nIf you want to classify a quadrilateral enter 2\n********************* ")
choice = int(input("Enter your choice: "))
if choice == 2:
rec1 = int(input("Enter your first side of the rectangle: "))
rec2 = int(input("Enter your second side of the rectangle: "))
rec3 = int(input("Enter your third side of the rectangle: "))
rec4 = int(input("Enter your fourth side of the rectangle: "))
if rec1 == rec2 == rec3 == rec4:
print("It is a square")
elif rec1 == rec3 and rec2 == rec4:
print("It is a rectangle")
elif rec1 == rec2 and rec3 == rec4:
print("It is a rectangle")
elif rec1 == rec4 and rec2 == rec3:
print("It is a rectangle")
elif choice == 1:
tri1 = int(input("Enter your first side of the triangle: "))
tri2 = int(input("Enter your second side of the triangle: "))
tri3 = int(input("Enter your third side of the triangle: "))
if abs(tri1+tri2)>tri3 and abs(tri1+tri3) > tri2 and abs(tri2+tri3) > tri1:
if tri1 == tri2 == tri3:
print("It is a equilateral triangle")
elif ((tri1 == tri2) and tri1 !=tri3 ) or ((tri2 == tri3) and tri2 !=tri1) or ((tri3 == tri1) and tri3 !=tri2):
print("It is a isosceles triangle")
else :
print("It is scalene triangle")
else:
print("It is a isosceles triangle")
else:
print("Invalid choice")