What is the output of the following Python code snippet?
d = {'a': 3, 'b': 1, 'c': 2}
print(sorted(d, key=d.get))
print(sorted(d, key=d.get))
Correct answer
A. ['b', 'c', 'a']
7 views
A. ['b', 'c', 'a']
7 views
Sorting dictionary keys by value.
Asked in: Python Interview Dictionaries
https://docs.python.org/3/tutorial/datastructures.html#dictionariesNot sure why the answer is A? Ask here and get an explanation.