Python Everyday 12: how can u miss the defaultdict?

When you wanna use a dict for item counting, you will get the KeyError as follow:

Hence what we looking for is a dict, which can instantiate an obj when a key doesn’t exist. “defaultdict” is the right answer.