counter print element 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: import counter python
from collections import Counter
from collections import Counter
list1 = ['x','y','z','x','x','x','y','z']
print(Counter(list1))
from collections import Counter