Learnmonkey Learnmonkey Logo
× Warning:

The tutorial you are reading is currently a work in-progress.

Python While Loops

What is a While Loop?

A while loop is like an if statement, but it runs the code inside the loop as long as the condition is true. Below is the format of a while loop:


while [condition]:
    # do something