Answer to Question #238408 in Python for Jhokent

Question #238408
In a right triangle, the square of the length of one side is equal to the sum of the squares of the lengths of the other
two sides. Write a program that prompts the user to enter the lengths of three sides of a triangle and then outputs a message
indicating whether the triangle is a right triangle.
1
Expert's answer
2021-09-17T02:30:08-0400
opp = eval(input('Enter opposite side here: '))
adj = eval(input('Enter adjacent side here: '))
hyp = eval(input('Enter hypotenuse here: '))
if hyp**2 == adj**2 + opp**2:
  print('This is a right triangle')
else:
  print('This isn\'t a right triangle')

Enter opposite side here: 3
Enter adjacent side here: 4
Enter hypotenuse here: 5
This is a right triangle

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS