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