What is the output of print(dict.fromkeys(['a', 'b'])) in Python?
print(dict.fromkeys(['a', 'b']))
Correct answer
D. {'a': None, 'b': None}
6 views
D. {'a': None, 'b': None}
6 views
dict.fromkeys sets the same value for all keys, default None.
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.