Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- colors = ['red', 'green', 'blue', 'orange', 'purple']
- # simple way
- index = 0
- for color in colors:
- print(f'{index} ---> {color}')
- index += 1
- # pythonic way
- for index, color in enumerate(colors):
- print(f'{index} ---> {color}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement