“tu es in Python” Code-Antworten

Python machen während

# 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

wie man eine Weile in Python eine Weile schreibt

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

tu es in Python

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

Python machen während der Schleife

# 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

Während der Schleife in Python

# Program to add natural numbers up to 'n'
# sum = 1+2+3+...+n

n = 10
sum = 0
i = 1

while i <= n:
    sum = sum + i
    i = i+1    # update counter

# print the sum
print("The sum is", sum)

# To take input from the user,
# n = int(input("Enter n: "))
Inquisitive Iguana

tu es in Python

while True:
    if condition:
        break

Ähnliche Antworten wie “tu es in Python”

Fragen ähnlich wie “tu es in Python”

Weitere verwandte Antworten zu “tu es in Python” auf Python

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen