What is the output of print('a' in {'a': 1}) in Python?
print('a' in {'a': 1})
Correct answer
B. True
5 views
B. True
5 views
The in operator on a dict checks the keys.
Asked in: Python Interview Dictionaries
https://docs.python.org/3/tutorial/datastructures.html#dictionariesNot sure why the answer is B? Ask here and get an explanation.