“Python to podczas pętli” 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

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 to podczas pętli

while True:
  //do something
  if (""" break condition """):
    break
slohobo

Python to podczas pętli

secret_word = "python"
counter = 0

while True:
    word = input("Enter the secret word: ").lower()
    counter = counter + 1
    if word == secret_word:
        break
    if word != secret_word and counter > 7: 
        break
Colorful Copperhead

Python to podczas pętli

i = 1

while True:
    print(i)
    i = i + 1
    if(i > 3):
        break
TheoTavLeVrai

Odpowiedzi podobne do “Python to podczas pętli”

Pytania podobne do “Python to podczas pętli”

Więcej pokrewnych odpowiedzi na “Python to podczas pętli” w Python

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

Przeglądaj inne języki kodu