Answers for "while loop python"

25

python main

def main():
    print("Hello World!")

if __name__ == "__main__":
    main()
Posted by: Guest on March-12-2020
49

python do while

# Python does not have a do-while loop. You can however simulate
# it by using a while loop over True and breaking when a certain
# condition is met.
# Example:
i = 1
while True:
    print(i)
    i = i + 1
    if(i > 3):
        break
Posted by: Guest on March-03-2020
13

while loop python

while (condition):
  doThis();
Posted by: Guest on December-10-2019
1

while loop python

# While loop counting to 10 in 2's

i = 2

while i <= 10:  # While i is less than or equal 10, it will add 2
  print(i)
  i = i + 2
Posted by: Guest on March-16-2021
0

while loop python

# while loop (python)
i = 0 

while i < 10:
  	i +=1 #or i = i + 1 
    print(i)
Posted by: Guest on September-17-2020
0

while loop python

print 0,4
Posted by: Guest on December-20-2020

Python Answers by Framework

Browse Popular Code Answers by Language