CurriculumPython while Loops, break and continue for KidsThe Full Night Patrol
Practice Challenge: while, break, and continue Together
while, break, and continue — all three, working together.
The Full Night Patrol
You have three tools now: while itself, break to stop, continue to skip. The challenge is choosing the right one, at the right moment.
A pattern worth knowing: while True: with a break inside is a completely valid way to write 'loop until something happens'.
room = 1
while True:
if room == 5:
break
print(room)
room = room + 1Output
1
2
3
4Check break conditions BEFORE continue conditions when both could apply — otherwise you might skip past the one that should have stopped everything.
Check your understanding
In a loop checking room == 10 (break) and room == 7 (continue), which should you check FIRST?
Why: There's no single rule that always applies — but when conditions COULD overlap, order decides which one actually fires. Think through your specific conditions rather than following a fixed pattern.
What you'll practice
Patrol rooms 1 to 6. Skip room 4 (it's empty — don't print it, keep going). Stop the whole patrol the moment you reach room 6 — don't print it either.
More from this topic
The Full Night Patrol is one lesson inside Python while Loops, break and continue for Kids — see the full lesson order and what the whole topic covers.
View the full topic →