While with break



examples/loops/while_break.py
import random
random.seed(0) # used so we can compare the results

total = 0
while total < 10000000:
    if total % 17 == 1:
        break

    if total ** 2 % 23 == 7:
        break

    print(total)
    total += random.randrange(20)

    # do the real work here

print("done")

0
12
25
26
34
50
65
77
done