Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Iteration and transformation

Transform collections with loops and comprehensions. Use generators to produce values incrementally, and collect them when you need a stored result.

Count positions and pair inputs with enumerate and zip directly in loops and comprehensions.

Traverse backward with reversed.

Chain iteration steps with iter to count, test, skip, pair, and collect items without writing the loop.