A while loop is a control statement using which the programmer can give instructions to the computer to execute a set of statement repeatedly as long as specified condition is satisfied. Ones the specified condition is false control comes out of the loop.
Q.) W.A.P to print 1 to 5.
i=1;
while i<=5:
print(i);
i=i+1
Output
1 2 3 4 5