Python count of items in a dictionary of lists

Viewed 11127

I have a dictionary of lists for which I want to add a value to a particular list... I have the following dictionary of lists.

d = {'a': [4,'Adam', 2], 'b': [3,'John', 4], 'c': [4,'Adam', 3], 'd': [4,'Bill' 3], 'e': [4,'Bob'], 'f': [4, 'Joe'], 'g': [4, 'Bill']}

I want to essentially count out the number of names and return in. So in this case it would be something like

Adam: 2
Bill: 2
John: 1
Bob: 1
Joe: 1

To make things easier, all names are the second element in the list or

for i in d:
     d[i][1]

Any idea how I can do this efficiently? I'm currently just manually checking for each name and counting and returning that =/

Thanks in advance!

2 Answers
Related