In short
Loops don't always need to run every round to the end. Sometimes you're done early, sometimes one item should be skipped, and sometimes you just need a placeholder. Three small keywords handle all three.
break exits a loop immediately, continue skips to the next round, and pass is a do-nothing placeholder for blocks you will fill in later.

Think of it like this
A local train journey
continue is the train skipping a station that's closed for repairs; it carries on to the next stop. break is pulling the emergency chain: the journey ends right here. pass is a station that's been built but has no service yet; the train slows, does nothing, and moves on.
Watch it happen
Processing orders: [250, -40, 600, 0, 1200, 300]
1/5250 is valid, so it's processed.
The big ideas
What you need to know
break exits the loop
The loop ends immediately and Python continues with the first line after it. Only the innermost loop is affected.
continue skips one round
The rest of the body is skipped for this item, and the loop moves on to the next. Great for ignoring bad data.
pass does nothing
A block can't be empty in Python. pass fills the gap while you plan, like an if branch or a function you'll write later.
for ... else
A loop's else block runs only if the loop finished without break. It's a neat way to say "searched everything, found nothing".
See it in code
Walk through the code
1orders = [250, -40, 600, 0, 1200, 300]2 3for amount in orders:4 if amount <= 0:5 continue # skip bad entries6 if amount > 1000:7 print(f"₹{amount} needs approval. Stopping.")8 break # leave the loop completely9 print(f"Processing ₹{amount}")10 11for attempt in range(3):12 pass # TODO: add retry logic13 14for name in ["Asha", "Ravi"]:15 if name == "Zoya":16 print("Found Zoya")17 break18else:19 print("Zoya is not in the list")1/4-40 and 0 hit continue, so their print line never runs.
Prints: Processing ₹250, Processing ₹600, ₹1200 needs approval. Stopping. Then: Zoya is not in the list.
Save yourself the pain
Common mistakes
Oops
Expecting break inside a nested loop to exit both loops.
Do this instead
break only exits the innermost loop. Use a flag variable, or move the loops into a function and return.
Oops
Leaving pass in finished code and forgetting the feature was never built.
Do this instead
Pair pass with a # TODO comment and search for TODOs before you call the work done.
Oops
Reading for ... else as "if the loop didn't run".
Do this instead
The else runs when the loop finishes normally, without break. It runs even for an empty list.
Your mission
Filter the attendance sheet
Quick check
What does continue do inside a for loop?
Go deeper
- 1Use break to stop searching a list once you find the item.
- 2Use continue to skip blank or invalid entries in a list.
- 3Use pass as a temporary body for a function or if block you haven't written yet.
More topics at this stop
Stuck on this topic? Ask an Insider
Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.