enumerate



examples/advanced/enumerate.py
names = ['Foo', 'Bar', 'Baz']

for i in range(len(names)):
    print(i,  names[i])

print('')

for i, n  in enumerate(names):
    print(i, n)

0 Foo
1 Bar
2 Baz

0 Foo
1 Bar
2 Baz