Skip to lesson content
Dev4Hub

Lesson 9 of 11

Python While Loops

1 min read1 sectionAI tutor ready

The while Loop

With the while loop we can execute a set of statements as long as a condition is true.

While loop

Python
i = 1
while i < 6:
    print(i)
    i += 1

Output

1
2
3
4
5

You've reached the end of this lesson.

Mark it complete to keep your place in the course — it counts toward your progress and your streak.