Post

@PythonPr Answer: B
Solution: my_dict is a dict with 3 keys: 'a', 'b', and 'c'.
Let's figure out what's:
my_dict.get('d', 4)
The `get` dictionary method is used to get value for a key from the dictionary. Similar to [] notation.
But there is a difference.
If you try to access
+
English

@PythonPr a non-existent key with [], you'll get an error.
So, something like
my_dict['d']
will give a KeyError, because 'd' isn't a key in my_dict.
But sometimes, if a key isn't in the dictionary, we don't want an error.
That's when `get` comes in to help...
+
English

