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".
Integers separated by a single space.
1 ≤ length of the side ≤ 1,000
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')
Input three integers(sides of a triangle) 8 6 7 No
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.
- Weekly Trends
- Python Interview Questions and Answers: Comprehensive Guide
- Scala Exercises, Practice, Solution
- Kotlin Exercises practice with solution
- MongoDB Exercises, Practice, Solution
- SQL Exercises, Practice, Solution - JOINS
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join