“ибо в питоне” Ответ

Питон для петли

# Python for loop

for i in range(1, 101):
  # i is automatically equals to 0 if has no mention before
  # range(1, 101) is making the loop 100 times (range(1, 151) will make it to loop 150 times)
  print(i) # prints the number of i (equals to the loop number)
  
for x in [1, 2, 3, 4, 5]:
  # it will loop the length of the list (in that case 5 times)
  print(x) # prints the item in the index of the list that the loop is currently on
Unknown Species

Питон для петли

for i in range(1.10):
	print(i)
    
#output: 1,2,3,4,5,6,7,8,9,10
AMXX

Питон для петли

for x in range(6): #The Loop
  print(x) #Output 0,1,2,3,4,5
Vasilije Dimitrijevic

Питон для петли

# if you want to get items and index at the same time,
# use enumerate
fruits = ['Apple','Banana','Orange']

for indx, fruit in enumerate(fruits):
	print(fruit, 'index:', indx)
Short Circuit

ибо в питоне

# how to use for in python for (range, lists)
fruits = ["pineapple","apple", "banana", "cherry"]
for x in fruits:
  if x == "apple":
    continue
  if x == "banana":
    break
  print(x)
# fron 2 to 30 by 3 step
for x in range(2, 30, 3):
  print(x)
Plain Parrot

Для петли Python

text = "Hello World"
for i in text:
  print(i)
#Output
#H, e, l, l, o, , W, o, r, l, d
for i in range(10):
  print(i)
#1, 2, 3, 4, 5, 6, 7, 8, 9, 10
TheProgrammer

Ответы похожие на “ибо в питоне”

Вопросы похожие на “ибо в питоне”

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

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

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