Question:
If I have the dictionary:
meu_dic = {A:3, B:5, C:0, D:10, E:2}
resulting from:
meu_dic = {i:lista.count(i) for i in lista}
I know that A appears 3 times in the list, B 5 times, etc. How can I get the maximum repetition value and its key? That is, for this dictionary it would have to return: 10, D .
Answer:
>>> max(map(tuple, map(reversed, Meu_dic.items())))
(10, 'D')
EDIT:
I thought of another way:
>>> max([i[::-1] for i in Meu_dic.items()])
(10, 'D')