Answers for "python while cycle"

22

how to write a while statement in python

myvariable = 10
while myvariable > 0:
  print(myvariable)
  myvariable -= 1
Posted by: Guest on January-08-2020
3

while loop

# simple while loop python.
input                                      output
a=1                                        1
while a<=10:                               4                               
      print(a)                             7
      a=a+3                                10
# here a=a+3 can be written as 'a+=3'
Posted by: Guest on November-25-2021
1

do while python

while <condition>:
    # Do whatever
Posted by: Guest on December-11-2020

Python Answers by Framework

Browse Popular Code Answers by Language