Lesson 9 of 12

For Loops 🔄

🎯 Grades 6–8 ⏱ ~25 minutes 💚 Intermediate

What You'll Learn

  • Use for loops to iterate over lists and ranges
  • Control iterations with range(start, stop, step)
  • Accumulate values inside a loop
Quick Check

1. What does range(3) produce?

A1, 2, 3
B0, 1, 2, 3
C0, 1, 2

2. What does += mean?

AAdd and reassign (a += 1 means a = a + 1)
BGreater than or equal
CCheck equality

3. How do you loop through a list called 'items'?

Awhile items:
Bfor item in items:
Cloop item from items:

4. What does range(2, 10, 3) produce?

A2, 3, 4, 5, 6, 7, 8, 9
B2, 5, 8
C2, 5, 8, 11