zip()
in combination with dict()
to combine the values of the two lists into a dictionary.def to_dictionary(keys, values): return dict(zip(keys, values))
to_dictionary(['a', 'b'], [1, 2]) # { a: 1, b: 2 }
Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️