Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Combining two lists using zip

names = ['Jan', 'Feb', 'Mar', 'Apr', 'May']
days =  [31, 28, 31, 30]

zipped = zip(names, days)
print(zipped)

pairs = list(zipped)
print(pairs)

Output:

<zip object at 0x7fc1b4464d40>
[('Jan', 31), ('Feb', 28), ('Mar', 31), ('Apr', 30)]