Python Programming - Data Types - Discussion
Discussion Forum : Data Types - General Questions (Q.No. 42)
42.
What will be the output of the following code snippet?
my_dict = {'a': 1, 'b': 2, 'c': 3}
result = my_dict.get('d', 'Not Found')
print(result)
Answer: Option
Explanation:
The
get()
method returns the value for the specified key. If the key is not found, it returns the default value, which is 'Not Found'
in this case.
Discussion:
Be the first person to comment on this question !
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers