How to find the key associated with the maximum value in a dictionary with Python

1 Answer

0 votes
dic = {'key1':34, 'key2':13, 'key3':89, 'key4':48, 'key5':50}

max_key = max(dic, key=dic.get)

print(max_key)   

 
 
'''
run:
 
key3

'''

 



answered Dec 17, 2024 by avibootz

Related questions

...