Introduction
The for loop
The while loop
7. while loop – example
Nested loops
break and continue
Summary

Instruction

Excellent! Apart from for loops, there are also while loops in Python. Let's first see them in action.

Exercise

Run the template code and observe what happens.

As you can see, the while loop worked just like our for loop from the first example in this section: it printed 10 sentences to the output.