Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python Sort the dictionary based on values

dt = {5:4, 1:6, 6:3}

sorted_dt = {key: value for key, value in sorted(dt.items(), key=lambda item: item[1])}

print(sorted_dt)
Source by www.programiz.com #
 
PREVIOUS NEXT
Tagged: #python #Sort #dictionary #based #values
ADD COMMENT
Topic
Name
5+5 =