- zip
Creating dictionary from two lists using zip
examples/functional/create_dict_using_zip.py
names = ['Jan', 'Feb', 'Mar', 'Apr'] days = [31, 28, 31, 30] zipped = zip(names, days) print(zipped) print(list(zipped)) zipped = zip(names, days) month = dict(zipped) print(month)
{'Jan': 31, 'Feb': 28, 'Mar': 31, 'Apr': 30}