“Python разные типы петли” Ответ

Различные типы F Python Loops

#loopies hehe
for x in range(10): #for loops.
  print("For loop")
while True: #while loop.
  print("While loop")
somewhatoriginal

Python разные типы петли

# a 'while' loop runs until the condition is broken
a = "apple"
while a == "apple":
  a = "banana" # breaks loop as 'a' no longer equals 'apple'
  
# a 'for' loop runs for the given number of iterations...
for i in range(10):
  print(i) # will print 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

# ... or through a sequence
array = [3, 6, 8, 2, 1]
for number in array:
  print(number) # will print 3, 6, 8, 2, 1
panda

Ответы похожие на “Python разные типы петли”

Вопросы похожие на “Python разные типы петли”

Больше похожих ответов на “Python разные типы петли” по Python

Смотреть популярные ответы по языку

Смотреть другие языки программирования