Syntax: while loop
while condition:
# Code to execute while the condition is True
Python program that demonstrates the use of while loop
# Initialize the counter
counter = 1
# Start the while loop
while counter <= 5:
print(counter) # Print the current value of counter
counter += 1 # Increment the counter by 1
Outout
1 2 3 4 5