defaultdict python count 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