Browse Source

Counter

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

4
README.md

@ -72,8 +72,8 @@ dict(zip(keys, values)) # Initiates a dict from two lists.
### Counter
```python
>>> from collections import Counter
>>> z = ['blue', 'red', 'blue', 'yellow', 'blue', 'red']
>>> Counter(z)
>>> colors = ['blue', 'red', 'blue', 'yellow', 'blue', 'red']
>>> Counter(colors)
Counter({'blue': 3, 'red': 2, 'yellow': 1})
>>> <counter>.most_common()[0][0]
'blue'

Loading…
Cancel
Save