counter in pythin code example
Example 1: counter method in python
from collections import Counter
list1 = ['x','y','z','x','x','x','y','z']
print(Counter(list1))
Example 2: counter method in python
Counter({'x': 4, 'y': 2, 'z': 2})
from collections import Counter
list1 = ['x','y','z','x','x','x','y','z']
print(Counter(list1))
Counter({'x': 4, 'y': 2, 'z': 2})