Loop control statements
break exits the nearest loop; continue skips to the next iteration; else on a loop runs only if the loop completed without break:
for n in [2, 3, 4]:
for d in range(2, n):
if n % d == 0:
break
else:
print(n, "is prime")
The for...else idiom is handy for search-and-fail scenarios.