Answers for "max value min key in dictionary python"

20

python find the key with max value

a_dictionary = {"a": 1, "b": 2, "c": 3}

# get key with max value
max_key = max(a_dictionary, key=a_dictionary.get)

print(max_key)
Posted by: Guest on April-27-2020
0

python get min max value from a dictionary

d = {'A': 4,'B':10}
min_v = min(zip(d.values(), d.keys()))
# min_v is (4,'A')

max_v = max(zip(d.values(), d.keys()))
# max_v is (10,'B')
Posted by: Guest on November-17-2020

Code answers related to "max value min key in dictionary python"

Python Answers by Framework

Browse Popular Code Answers by Language