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)
1
Not Found
4
Error
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:

Your comments will be displayed after verification.