Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- names = ['Peter Parker', 'Clark Kent', 'Wade Wilson', 'Bruce Wayne']
- heroes = ['Spiderman', 'Superman', 'Deadpool', 'Batman']
- # access elements of second list using loop index
- for index, name in enumerate(names):
- hero = heroes[index]
- print(f'{name} ---> {hero}')
- # pythonic way to do the same
- for name, hero in zip(names, heroes):
- print(name + " ---> "+ hero)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement