for n in range(10): if n == 3: # skip this one continue if n == 6: # stop the loop break print(n)
exit early or skip an iteration