Which method is used to retrieve all keys from a dictionary in Python?
-
A
keys()
Correct answer
-
B
values()
-
C
items()
-
D
get()
17 views
Explanation
The keys() method returns a view object that displays a list of all keys in the dictionary.
Doubts & discussion
Not sure why the answer is A? Ask here and get an explanation.
Ask a doubt about this MCQ