Locked lesson.
About this lesson
Learn to loop using a While loop.
Exercise files
Download this lesson’s related exercise files.
While Loops.docx59.1 KB While Loops - Solution.docx
59.1 KB
Quick reference
While Loops
While loops allow us to iterate until a condition is met.
When to use
Use a while loop whenever you need to iterate.
Instructions
Creating a while loop is pretty easy:
num = 0
while (num < 10):
print(num)
num += 1
Hints & tips
- Create a counter
- Do your loop
- Don't forget to increment your counter!
Lesson notes are only available for subscribers.