I want to count the value of the key dictionary. I understood Counter in typing module ignore the element with value 0. The code is:
from functools import reduce
from typing import Counter
pen={'age':0, 'cost':10}
bottle={'age':0,'cost':30}
all = [pen, bottle]
reduce(lambda a,b: a+b, (Counter(item) for item in all))
The output is {'cost':40} and Counter ignores the element with count 0. I want the output is {'cost':40, 'age':0}. There are other ways to count the value of keys in the dictionary?