Python для цикла со счетчиком

Примеры кода

23
0

python3 перебирает индексы

items=['baseball','basketball','football']
for index, item in enumerate(items):
    print(index, item)
6
0

для цикла с индексом python3

colors = ["red", "green", "blue", "purple"]

for i in range(len(colors)):
    print(colors[i])
0
0

python для цикла получить номер итерации

for idx, item in enumerate(list):
    print(item)
    print('Iteration number: ', idx)

Похожие страницы

Похожие страницы с примерами

На других языках

Эта страница на других языках

English
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................