Published
- 1 min read
value count a list python
The solution for this is noted below
value count a list python
Solution
from collections import Counter
z = ['blue', 'red', 'blue', 'yellow', 'blue', 'red']
Counter(z)
>>> Counter({'blue': 3, 'red': 2, 'yellow': 1})
Try other methods by searching on the site. That is if this doesn’t work