James G. answered 05/16/18
Tutor
4.9
(1,012)
Tutor
The zip function will take a number of ordered collections that are the same length and creates an iterator that returns a merged version. The first element in each list returned together in a tuple. The same with each sequential element from all the lists. For example:
for x in zip([1, 2, 3], ['rock', 'paper', 'scissors']):
print(x)
(1, 'rock')
(2, 'paper')
(3, 'scissors')