In the code below, I\'d like the while loop to exit as soon as a + b + c = 1000. However, testing with
If you don't want to make a function ( which you should and refer to Ashwini's answer in that case), here is an alternate implementation.
>>> x = True
>>> for a in range(3,500):
for b in range(a+1, 500):
c = (a**2 + b**2)**0.5
if a + b + c == 1000:
print a, b, c
print a*b*c
x = False
break
if x == False:
break
200 375 425.0
31875000.0