python-euler/solutions/009/specialpythagoreantriplet.py

24 lines
585 B
Python
Raw Normal View History

2023-07-31 14:17:27 -04:00
def is_pythagorean_triplet(a, b, c):
if (a * a + b * b) == (c * c):
return True
else:
return False
tripletFound = False
for i in range(1,500):
for j in range(1,500):
for k in range(1,500):
if is_pythagorean_triplet(i, j, k):
print("triplet:",i,j,k)
if i+j+k == 1000:
print("The product of abc is: " + str(i*j*k))
tripletFound = True
if tripletFound:
break
if tripletFound:
break
if tripletFound:
break