← Python for Beginners

Lesson 2 of 3 · 10 min

Loops that repeat work

A for loop repeats code for each item: for day in days: print(day).

A while loop repeats until a condition becomes false — always make sure it can end.

Practice

Print the numbers 1 to 10 with a for loop, then again with a while loop.

Quiz

+50 pts
1. Which loop runs per item in a list?
2. A while loop stops when…

Optional resources

Your lesson toolkit

No purchase or partner signup is required to complete this course or earn quiz points.

These are official product links, not active affiliate links. Learnly does not currently earn a commission from them.

Replit

Try Python exercises in a browser coding workspace.

Free and paid plans; usage limits and feature availability vary.

Explore tool