Inicialize o dicionário para zero em Python
from collections import defaultdict
my_dict = defaultdict(int)
my_dict[1] += 1
Unusual Unicorn
from collections import defaultdict
my_dict = defaultdict(int)
my_dict[1] += 1