miércoles, 4 de septiembre de 2024

Getting the key with the max value from a dict

 st

{'Ambiorix': 90, 'Rosa': 78, 'Eddy': 51, 'Maria': 32}




Max values from a  dict


top=[a for a in st.keys() if st[a]==max(st.values())]


['Ambiorix']






[st[a] for a in st.keys()]

[90, 78, 51, 32]








list(st.values())

[90, 78, 51, 32]



list(st.keys())

['Ambiorix', 'Rosa', 'Eddy', 'Maria']

No hay comentarios:

Publicar un comentario