Control Flow, Iteration & Loop-Else

Unit 2: Control Flow, Scope & Recursion · 7 min read

Clean branching, structural pattern matching, enumerate/zip idioms, and the exact semantics of for...else and while...else.

Key Concepts

  • for...else as a no-break completion handler
  • Iterating directly with enumerate() and zip(strict=True)
  • Never mutating a list while iterating over it
  • Guard clauses to keep nesting shallow

Official Python Docs

Back to Python Notes Hub