Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
The for loop
The while loop
7. while loop – example
Nested loops
break and continue


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


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.