Answers for "python Sorted Word frequency count"

0

python Sorted Word frequency count

>>> # Tally occurrences of words in a list
>>> from collections import Counter
>>> cnt = Counter()
>>> for word in ['red', 'blue', 'red', 'green', 'blue', 'blue']:
...     cnt[word] += 1
>>> cnt
Counter({'blue': 3, 'red': 2, 'green': 1})
Posted by: Guest on February-28-2021

Code answers related to "python Sorted Word frequency count"

Python Answers by Framework

Browse Popular Code Answers by Language