aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Anand Krishna <[email protected]>2021-02-06 21:16:23 +0400
committerGravatar GitHub <[email protected]>2021-02-06 21:16:23 +0400
commit255f2215279d08386152b12dc8adec037538cba7 (patch)
treed906540f67828f5144110bfb771b070e637a55ee
parentRefer to `defaultdict` tag in `dict-get` (diff)
Reword comment in example
-rw-r--r--bot/resources/tags/dict-get.md4
1 files changed, 2 insertions, 2 deletions
diff --git a/bot/resources/tags/dict-get.md b/bot/resources/tags/dict-get.md
index 6f8299dc7..7657f420a 100644
--- a/bot/resources/tags/dict-get.md
+++ b/bot/resources/tags/dict-get.md
@@ -1,5 +1,5 @@
Often while using dictionaries in Python, you may run into `KeyErrors`. This error is raised when you try to access a key that isn't present in your dictionary.\
-While you can use a `try` and `except` block to catch the `KeyError`, Python also gives you some other neat ways to handle them.\
+While you can use a `try` and `except` block to catch the `KeyError`, Python also gives you some other neat ways to handle them.
__**The `dict.get` method**__
@@ -8,7 +8,7 @@ The [`dict.get`](https://docs.python.org/3/library/stdtypes.html#dict.get) metho
>>> my_dict = {"foo": 1, "bar": 2}
>>> print(my_dict.get("foobar"))
None
->>> print(my_dict.get("foobar", 3)) # here 3 is the default value to be returned, in case the key doesn't exist
+>>> print(my_dict.get("foobar", 3)) # here 3 is the default value to be returned, because the key doesn't exist
3
```