Looping over index



examples/lists/loop.py
planets = ['Mercury', 'Venus', 'Earth', 'Mars', 'Jupiter', 'Saturn']
for var in planets:
    print(var)

Mercury
Venus
Earth
Mars
Jupiter
Saturn


examples/lists/loop_index.py
planets = ['Mercury', 'Venus', 'Earth', 'Mars', 'Jupiter', 'Saturn']
for ix in range(len(planets)):
    print(ix, planets[ix])

0 Mercury
1 Venus
2 Earth
3 Mars
4 Jupiter
5 Saturn