Brainlag
  1. Python
  2. Advanced
26/42 lessons

Better loops: enumerate, zip and friends

25 min5 exercisesPremium

Loop like a Python programmer: enumerate for positions, zip for lists side by side, reversed, and why you never change a list while looping over it.

The skill
Loop with enumerate, zip and reversed, and never change a list while looping over it.
You make
Race result boards and a score cleanup that does not skip items.

Premium lesson

£7.99 a month or £59 a year. Cancel any time.

Builds on 25 Checkpoint: errors, files and JSON. Free to try: Python Foundations and the playground.

Step 1 of 9
exercise_1.py

You've reached the good stuff.

5 exercises in this lesson, checked as you type. Premium opens every lesson after Foundations, in all four courses.

Python 3.13