python built in counter code example
Example 1: counter method in python
Counter({'o': 3, ' ': 3, 'u': 3, 'e': 2, 'l': 2, 't': 2, 'r': 2, '9': 2, 'W': 1,
'c': 1, 'm': 1, 'G': 1, 'T': 1, 'i': 1, 'a': 1, 's': 1, '!': 1})
Example 2: python counting dictionary
counts = dict()
for i in items:
counts[i] = counts.get(i, 0) + 1