﻿ 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 Python skills with w3resource's quiz

﻿

## Python: Tips of the Day

Returns the symmetric difference between two lists, after applying the provided function to each list element of both

Example:

```def tips_symmetric_difference_by(p, q, fn):
_p, _q = set(map(fn, p)), set(map(fn, q))
return [item for item in p if fn(item) not in _q] + [item for item in q if fn(item) not in _p]
from math import floor
print(tips_symmetric_difference_by([4.2, 2.4], [4.6, 6.8],floor))
```

Output:

```[2.4, 6.8]
```