Guest User

Untitled

a guest
Feb 19th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. sides = []
  2. count = 0
  3. while count < 3:
  4. x = input("Enter length of triangles: ")
  5. if not x.isdigit() or not float(x) >= 1:
  6. print(f"It's impossible to create Pythagorean Triples with a non-positive integer {x}")
  7. exit()
  8. sides.append(int(x))
  9. count += 1
  10.  
  11. sides.sort()
  12.  
  13. if sides[0]**2 + sides[1]**2 == sides[2]**2:
  14. print("The sides {},{}, and {} are Pythagorean Triples".format(*sides))
  15. else:
  16. print("The sides {}, {}, and {} are not Pythagorean Triples".format(*sides))
Add Comment
Please, Sign In to add comment