which one is faster counter or defaultdiction in python code example
Example: defaultdict item count
>>> dict = {'a': 1, 'b': 1, 'c': 3, 'd': 4}
Item Count
>>> len(dict)
4
Count of Items Values
>>> sum(dict.values())
9
>>> dict = {'a': 1, 'b': 1, 'c': 3, 'd': 4}
Item Count
>>> len(dict)
4
Count of Items Values
>>> sum(dict.values())
9