Q. What is the output of dict(zip([‘a’, ‘b’], [1, 2]))?

A
{'a': 1, 'b': 2}
B
{'a': 'b', 1: 2}
C
['a', 'b', 1, 2]
D
Error
Solution:

zip([‘a’, ‘b’], [1, 2]) pairs keys and values, creating {‘a’: 1, ‘b’: 2}.

Entri Contact Image

Get Expert Advice for Free: Register for Your Free Consultation Now!