In def get_mega_dict lists my_dict dict for my_list in lists for item

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
In [8]: def get_mega_dict(lists):
...: my_dict = dict()
...: for my_list in lists:
...: for item in my_list:
...: my_dict[item]=my_dict.get(item,0)+1
...: return my_dict
...:
In [9]: print get_mega_dict([[1,2,3],[2,3,4],[1,4,5]])
{1: 2, 2: 2, 3: 2, 4: 2, 5: 1}
In [10]: print get_mega_dict([[1,2,3],[2,3,4],[1,2,4,5]])
{1: 2, 2: 3, 3: 2, 4: 2, 5: 1}