Study Path Agent Study Path Agent
Generate Your Own
Test Basic Python Loops
30 topics across 6 chapters
Chapter 1
Loop Fundamentals (what, when, and common patterns)
1
Repetition vs. iteration: when a loop is the right tool
2
Loop variables and state: counters, accumulators, flags
3
Common loop patterns: sum, count, search, min/max
4
Index-based vs. element-based looping (and why element-based is safer)
Chapter 2
for Loops (iteration over sequences and ranges)
5
Iterating over lists/tuples/strings (elements)
6
range(): start/stop/step and off-by-one rules
7
enumerate(): getting index + value cleanly
8
zip(): iterating over multiple sequences in parallel
9
Iterating over dicts: keys(), values(), items()
10
Nested for loops: grids, pairs, and time complexity intuition
Chapter 3
while Loops (condition-driven repetition)
11
Counters and sentinels (e.g., loop until input is 'q')
12
Input-validation loops (keep asking until valid)
13
Detecting and fixing infinite loops (instrumentation and sanity checks)
Chapter 4
Loop Control Flow (break, continue, else)
14
break: exiting early (search loops, stopping criteria)
15
continue: skipping to next iteration safely
16
Loop else clause: when it runs and why it’s useful
17
Control-flow pitfalls: modifying lists while iterating, shadowing variables
Chapter 5
Testing Loops (assertions, edge cases, and debugging)
18
Write testable loop functions: pure inputs/outputs (no prints)
19
Use assertions to test loop results (happy path + edge cases)
20
Edge cases checklist: empty sequences, single item, negatives, zero step
21
Debugging loops with prints/logging (show iteration number + key variables)
22
Tracing by hand: build a table of variable values per iteration
23
Refactoring loops: extract helper functions, reduce nesting
Chapter 6
Practice Tasks (mini-exercises to validate mastery)