Defaultdict allow you to specify a default value in cases that would have raised a KeyError on a normal dict.
In [3]:
fromcollectionsimportdefaultdictbonus_points=defaultdict(lambda:0)# The following works as expected instead of raising a KeyErrorbonus_points['B00804592']=bonus_points['B00804592']+1