while loop is used when we don't know how many times to repeat this loop to reach our goal.


Syntax:

Here we explain the syntax with numbers.

----------------------------------------------------------------------------------------------------------------------------

i=0

while i<10:

      print(i)

      i=i+1

----------------------------------------------------------------------------------------------------------------------------

Output:


output of while loop syntax.