Python-100-Days/公开课/文档/年薪50W+的Python程序员如何写代码/code/Python/opencourse/part02/idiom04.py

10 lines
205 B
Python

fruits = ['orange', 'grape', 'pitaya', 'blueberry']
# index = 0
# for fruit in fruits:
# print(index, ':', fruit)
# index += 1
for index, fruit in enumerate(fruits):
print(index, ':', fruit)