Let's consider a simple problem solved by default dictionary; here we would like to calculate the frequency of elements present in the list. Let's examine the scenario with an example:
from collections import defaultdict
game = defaultdict(int)
list1 = ['cricket', 'badminton', 'hockey' 'rugby', 'golf', 'baseball' , 'football']
for each in list1:
game[each]= game[each]+1
print game
As the default value is initialized with 0 we have incremented it with 1, and, in this way, we can calculate the frequency of elements present in the list: