-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtriangle2.py
More file actions
24 lines (18 loc) · 768 Bytes
/
triangle2.py
File metadata and controls
24 lines (18 loc) · 768 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
'''
Author:Irene
Date:29-11-24
Description:A program that accepts the lengths of three sides of a triangle as inputs. The program should output whether or not the triangle is a right triangle (Recall from the Pythagorean Theorem that in a right triangle, the square of one side equals the sum of the squares of the other two sides). Implement using functions.
'''
def right_triangle(side):
side.sort()
if side[2]**2==side[0]**2+side[1]**2:
return True
return False
side=[]
side.append(int(input("Enter length of side 1")))
side.append(int(input("Enter length of side 2")))
side.append(int(input("Enter length of side 3")))
if right_triangle(side):
print("It is right angled triangle")
else:
print("It is not a right angled triangle")