Browse Source

Counter, frozenset

pull/27/head
Jure Šorn 6 years ago
parent
commit
77e5e86e3d
1 changed files with 2 additions and 2 deletions
  1. 4
      README.md

4
README.md

@ -84,7 +84,7 @@ value = <dict>.pop(key) # Removes item from dictionary.
### Counter ### Counter
```python ```python
>>> from collections import Counter >>> from collections import Counter
>>> colors = ['blue', 'red', 'blue', 'yellow', 'blue', 'red']
>>> colors = ['red', 'blue', 'yellow', 'blue', 'red', 'blue']
>>> counter = Counter(colors) >>> counter = Counter(colors)
Counter({'blue': 3, 'red': 2, 'yellow': 1}) Counter({'blue': 3, 'red': 2, 'yellow': 1})
>>> counter.most_common()[0] >>> counter.most_common()[0]
@ -120,7 +120,7 @@ Set
``` ```
### Frozenset ### Frozenset
#### Is hashable so it can be used as a key in dictionary.
#### Is hashable, meaning it can be used as a key in dictionary.
```python ```python
<frozenset> = frozenset(<collection>) <frozenset> = frozenset(<collection>)
``` ```

Loading…
Cancel
Save