What is the output of print(dict(a=1, b=2)) in Python?
print(dict(a=1, b=2))
Correct answer
D. {'a': 1, 'b': 2}
8 views
D. {'a': 1, 'b': 2}
8 views
dict(a=1, b=2) builds a dictionary from keyword arguments.
Asked in: Python Interview Dictionaries
https://docs.python.org/3/tutorial/datastructures.html#dictionariesNot sure why the answer is D? Ask here and get an explanation.