Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

get highest value from dictionary python

ages = {'Matt' : 30, 'Katie': 29, 'Nik': 31, 'Jack': 43}

#get the max value in Python dict
max_value = max(ages.values())
print(max_value)
#get the key for a dicts max value
max_key = max(ages, key=ages.get)
print(max_key)
        
Source by datagy.io #
 
PREVIOUS NEXT
Tagged: #highest #dictionary #python
ADD COMMENT
Topic
Name
9+1 =