The collections module also provides a variant of a dictionary called Default Dictionary. A default dictionary pre initializes the values in a dictionary to a certain type.
To understand its need, let's take the following example.
Let's say we need to store the position of all occurrences of all the words in a string. We would use a dictionary with the key as the word and the value as a list of positions where the word appears. To do this we would have to first initialize the value for new keys to a list.
As you can see we have an if condition in place to check if the key (word) exists in the dictionary or not. If it is not present we initialize the key with the value set to a list.
Using default dictionaries we could omit this condition and simplify our code.