counter element python 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
from collections import Counter
my_str = "Welcome to Guru99 Tutorials!"
print(Counter(my_str))
Example 3: count values in list usiing counter
from collections import Counter