Skip to content

The basics · Loops

Stopping early, and loops in loops

break, continue, and the n × n of a nested loop. · 10 minutes

Predict first

What does this print?

1for n in [4, 7, 10, 3]:
2 if n > 5:
3 break
4 print(n)