﻿ Python: Check whether three given lengths of three sides form a right triangle - w3resource

# Python: Check whether three given lengths of three sides form a right triangle

## Python Basic - 1: Exercise-34 with Solution

Write a Python program to check whether three given lengths (integers) of three sides form a right triangle. Print "Yes" if the given sides form a right triangle otherwise print "No".

Input:
Integers separated by a single space.
1 ≤ length of the side ≤ 1,000

Pictorial Presentation: Sample Solution:

Python Code:

``````print("Input three integers(sides of a triangle)")
int_num = list(map(int,input().split()))
x,y,z = sorted(int_num)
if x**2+y**2==z**2:
print('Yes')
else:
print('No')
``````

Sample Output:

```Input three integers(sides of a triangle)
8 6 7
No
```

Flowchart: Python Code Editor:

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.

﻿