What is the output of print(len({'a': 1, 'b': 2, 'c': 3})) in Python?
print(len({'a': 1, 'b': 2, 'c': 3}))
Correct answer
D. 3
5 views
D. 3
5 views
len() of a dict returns the number of keys.
Asked in: Python Interview Advanced
https://docs.python.org/3/library/index.htmlNot sure why the answer is D? Ask here and get an explanation.