Python While Loop

Below code demonstrates using a Python while loop.

#Python while loop
def main():
  x = 0
  #define while loop
  while(x < 5):
    print(x)
    x = x + 1

if __name__ == "__main__":
  main()



------------------------------------------------
#Output
0
1
2
3
4

Comments

Popular posts from this blog

How to write to a file in Kotlin

Python Tkinter example