Loops in Python

Module 3 · Loops in Python · Lesson 6 of 6

Quiz

Five questions on while, for, range and loop control. Run each one in your head before you answer.

1

What does this print?

for i in range(3):
    print(i)
2

What does continue do inside a loop?

3

A while True loop with no break inside…

4

What is the result?

list(range(2, 5))
5

A loop's else clause runs…

Repetition unlocked. You can now make code run as many times as you need — and the loop that gives this whole site its name finally has its lessons. Next in this module: lists, the collections loops were made for.