diff --git a/README.md b/README.md index 03289ce..bbc123b 100644 --- a/README.md +++ b/README.md @@ -94,8 +94,9 @@ value = .pop(key) # Removes item or raises KeyErro ### Counter ```python >>> from collections import Counter ->>> colors = ['red', 'blue', 'yellow', 'blue', 'red', 'blue'] +>>> colors = ['blue', 'red', 'blue', 'red', 'blue'] >>> counter = Counter(colors) +>>> counter['yellow'] += 1 Counter({'blue': 3, 'red': 2, 'yellow': 1}) >>> counter.most_common()[0] ('blue', 3) diff --git a/index.html b/index.html index 16c07dd..f68fc36 100644 --- a/index.html +++ b/index.html @@ -275,8 +275,9 @@ value = <dict>.setdefault(key, default=Nonefor k, v in <dict>.items() if k in keys} # Filters dictionary by keys.

Counter

>>> from collections import Counter
->>> colors = ['red', 'blue', 'yellow', 'blue', 'red', 'blue']
+>>> colors = ['blue', 'red', 'blue', 'red', 'blue']
 >>> counter = Counter(colors)
+>>> counter['yellow'] += 1
 Counter({'blue': 3, 'red': 2, 'yellow': 1})
 >>> counter.most_common()[0]
 ('blue', 3)