Advertise with us

While loop in python

Posted by  Franco Falkov
 506  View(s)
Ratings:
Rate this:

Explain while loop in python ?

  1. Re: While loop in python

    The while Loop in python : 

    Example:

    i = 1 
    while i < 5:
      print(i)
      i += 1

    Break statement : 

    EX:

    i = 1 
    while i < 5:
      print(i)
      if i == 3:
        break
      i += 1


    continue statement:

    Ex:

    i = 0 
    while i < 5:
      i += 1
      if i == 3:
        continue
      print(i)


Answer