Browse Source

use most_common(n)

pull/41/head
TylerJackk 5 years ago
parent
commit
c8a635dab3
1 changed files with 2 additions and 2 deletions
  1. 4
      README.md

4
README.md

@ -96,8 +96,8 @@ value = <dict>.pop(key) # Removes item from dictionary.
>>> colors = ['red', 'blue', 'yellow', 'blue', 'red', 'blue']
>>> counter = Counter(colors)
Counter({'blue': 3, 'red': 2, 'yellow': 1})
>>> counter.most_common()[0]
('blue', 3)
>>> counter.most_common(1)
[('blue', 3)]
```

Loading…
Cancel
Save