__zero__

Pythagorean triples

Nov 19th, 2018
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.43 KB | None | 0 0
  1. """
  2. @author: __zero__
  3. """
  4.  
  5. from math import sqrt
  6. print("\n\t\tPythagorean triples\n\n")
  7. for cat in range(1,100):
  8.     for cat2 in range(1,100):
  9.         for hipo in range(1,100):
  10.             if ((cat**2 + cat2**2) == hipo**2):
  11.                 print("")
  12.                 print(f"leg1: {cat}, leg2: {cat2}: H: {hipo} -- Check: {cat**2}, + {cat2**2}: {(cat**2)+(cat2**2)} <-- sqrt {int(sqrt(cat**2+cat2**2))}")
  13. input()
Advertisement
Add Comment
Please, Sign In to add comment