“Python, podczas gdy” Kod odpowiedzi

Python robi

# 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
SkelliBoi

Jak napisać trochę czasu w Pythonie

myvariable = 10
while myvariable > 0:
  print(myvariable)
  myvariable -= 1
Thoughtful Trout

robić pobytu w Python

There is no direct do while loop in python.
Lala Talishinskaya

Python to podczas pętli

# A python equivilant to do-while
n = 0
while True: # Do
  print(n)
  n += 1
  if n%3 == 0: # While
    break
# Output: 0, 1, 2
fmoeran

Python, podczas gdy

'''Example to illustrate
the use of else statement
with the while loop'''

counter = 0

while counter < 3:
    print("Inside loop")
    counter = counter + 1
else:
    print("Inside else")
Said HR

Python, podczas gdy

while True:
    ...

    if ...:
        break

    ...
Defiant Dog

Odpowiedzi podobne do “Python, podczas gdy”

Pytania podobne do “Python, podczas gdy”

Więcej pokrewnych odpowiedzi na “Python, podczas gdy” w Python

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu