Answers for "count a certain value inside a list"

2

value count a list python

from collections import Counter
z = ['blue', 'red', 'blue', 'yellow', 'blue', 'red']
Counter(z)
>>> Counter({'blue': 3, 'red': 2, 'yellow': 1})
Posted by: Guest on October-26-2021

Code answers related to "count a certain value inside a list"

Python Answers by Framework

Browse Popular Code Answers by Language