DekGenius.com
Home
(current)
Dictionary
BOOKS
LYRICS
CHORD
SCRIPT & CODE EXAMPLE
Karaoke language
Search
Go
SCRIPT & CODE EXAMPLE
CODE EXAMPLE FOR PYTHON
find the highest 3 values in a dictionary.
>>> sorted(my_dict, key=my_dict.get, reverse=True)[:3] ['K', 'B', 'A']
Source by stackoverflow.com #
PREVIOUS
NEXT
Tagged:
#find
#highest
#values
ADD COMMENT
Topic
COMMENT
Name
4+9 =
Submit