** * This article is from Udemy "[Introduction to Python3 taught by active Silicon Valley engineers + application + American Silicon Valley style code style](https://www.udemy.com/course/python-beginner/" Introduction to Python3 taught by active Silicon Valley engineers + application + American Silicon Valley style code style ")" It is a class notebook for myself after taking the course of. It is open to the public with permission from the instructor Jun Sakai. ** **
for
i = 0
for fruit in ['apple', 'banana', 'orange']:
print(i, fruit)
i += 1
result
0 apple
1 banana
2 orange
enumerate
for i, fruit in enumerate(['apple', 'banana', 'orange']):
print(i, fruit)
result
0 apple
1 banana
2 orange
Recommended Posts