Dev Helpers
← Back

Align missing survey responses by participant

Align missing survey responses by participant using Python lists and dictionaries.

Open this example in the interactive library

Source code

from itertools import zip_longest
names = ['Ada', 'Kim', 'Jo']
votes = [4, 5]
print(dict(zip_longest(names, votes, fillvalue=None)))

Sample output

{'Ada': 4, 'Kim': 5, 'Jo': None}