The while loop in python is used to iterate over a block of code as long as the test expression is true.we generally use this loop when we don't know beforehand,the number of times to iterate.the foolowing syntax of while loop in python.
while condition:
body of while loop
a = 1;
while a<=5:
print(a);
a=a+1;