I\'m using Python\'s max function to find the largest integer in a dictionary called count, and the corresponding key (not quite sure if I\'m saying it properly
Fast single pass:
a = { 'a': 120, 'b': 120, 'c': 100 }
z = [0]
while a:
key, value = a.popitem()
if value > z[0]:
z = [value,[key]]
elif value == z[0]:
z[1].append(key)
print z
#output:
[120, ['a', 'b']]
And an amusing way with defaultdict:
import collections
b = collections.defaultdict(list)
for key, value in a.iteritems():
b[value].append(key)
print max(b.items())
#output:
(120, ['a', 'b'])