Py

Loops

Module 5 of 14, Beginner
🔁

Loops

Repeat work with while and for loops, count with range(), steer loops with break and continue, and nest loops to build grids.

0 of 5 lessons complete

5 lessons, 46 min

Start module

Lessons

1

The while loop

Repeat code for as long as a condition stays True.

8 min
2

The for loop

Visit every item in a sequence and total things up as you go.

9 min
3

Counting with range()

Loop a set number of times and count up, down or in steps.

9 min
4

break, continue and else

Stop a loop early, skip items, and detect when no break happened.

10 min
5

Nested loops

Put a loop inside a loop to handle rows, columns and combinations.

10 min
📋
Next module

Lists & Tuples