-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRight_Angle_Triangle_Check.py
More file actions
76 lines (66 loc) · 2.91 KB
/
Right_Angle_Triangle_Check.py
File metadata and controls
76 lines (66 loc) · 2.91 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<<<<<<< HEAD
def rightangletriangle():
angle_1 = int(input("Enter the first angle "))
angle_2 = int(input("Enter the second angle "))
angle_3 = int(input("Enter the third angle "))
# A Triangle is a closed figure with 3 sides
# A Right angle triangle is a triangle having one angle of 90 degree
# The sum of all three angles of triangle is always 180 degree
# Step 1
# Check for sum of angles
if (angle_1+angle_2+angle_3 < 180 or angle_1+angle_2+angle_3 > 180):
print("Angles does not belong to a triangle")
# Step 2
# Conditions for right angle triangle
# Condition 1 : Two angles of 45 degree and one of 90 degree
# Condition 2 : One angle of 30 degree other of 60 degree and third of 90 degree
# Check for Condition 1
elif (angle_1 == 45 and angle_2 == 45 and angle_3 == 90):
print("It is a right angle triangle")
elif (angle_1 == 45 and angle_2 == 90 and angle_3 == 45):
print("It is a right angle triangle")
elif (angle_1 == 90 and angle_2 == 45 and angle_3 == 45):
print("It is a right angle triangle")
# Check for Condition 2
elif (angle_1 == 30 and angle_2 == 60 and angle_3 == 90):
print("It is a right angle triangle")
elif (angle_1 == 60 and angle_2 == 90 and angle_3 == 60):
print("It is a right angle triangle")
elif (angle_1 == 90 and angle_2 == 60 and angle_3 == 30):
print("It is a right angle triangle")
else :
print ("The angles do not belong to a right angle triangle")
=======
def rightangletriangle():
angle_1 = int(input("Enter the first angle "))
angle_2 = int(input("Enter the second angle "))
angle_3 = int(input("Enter the third angle "))
# A Triangle is a closed figure with 3 sides
# A Right angle triangle is a triangle having one angle of 90 degree
# The sum of all three angles of triangle is always 180 degree
# Step 1
# Check for sum of angles
if (angle_1+angle_2+angle_3 < 180 or angle_1+angle_2+angle_3 > 180):
print("Angles does not belong to a triangle")
# Step 2
# Conditions for right angle triangle
# Condition 1 : Two angles of 45 degree and one of 90 degree
# Condition 2 : One angle of 30 degree other of 60 degree and third of 90 degree
# Check for Condition 1
elif (angle_1 == 45 and angle_2 == 45 and angle_3 == 90):
print("It is a right angle triangle")
elif (angle_1 == 45 and angle_2 == 90 and angle_3 == 45):
print("It is a right angle triangle")
elif (angle_1 == 90 and angle_2 == 45 and angle_3 == 45):
print("It is a right angle triangle")
# Check for Condition 2
elif (angle_1 == 30 and angle_2 == 60 and angle_3 == 90):
print("It is a right angle triangle")
elif (angle_1 == 60 and angle_2 == 90 and angle_3 == 60):
print("It is a right angle triangle")
elif (angle_1 == 90 and angle_2 == 60 and angle_3 == 30):
print("It is a right angle triangle")
else :
print ("The angles do not belong to a right angle triangle")
>>>>>>> 4ceec94dd569fc51f4c88cbb5ac873ea4669e5ec
rightangletriangle()