Python While Loop

Last Updated : 23 Dec, 2025

Python While Loop is used to execute a block of statements repeatedly until a given condition is satisfied. When the condition becomes false, the line immediately after the loop in the program is executed.

In this example, the condition for while will be True as long as the counter variable (count) is less than 3. 

Python
count = 0
while count < 3:
    count = count + 1
    print("Hello Geek")

Output
Hello Geek
Hello Geek
Hello Geek

Let's take a look at Python While Loop in detail:

Syntax

while expression:
statement(s)

  • condition: This is a boolean expression. If it evaluates to True, the code inside the loop will execute.
  • statement(s): These are the statements that will be executed during each iteration of the loop.

While Loop Flowchart