Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to sort dictionary in ascending order by sorted lambda function in python

dict = [
    {"name": "Fuad", "age": 22},
    {"name": "Bristy", "age": 20},
    {"name": "Tonni", "age": 17},
    {"name": "Riya", "age": 15},
    {"name": "Badol", "age": 19},
]

print("Result after sort - ")
print(sorted(dict, key=lambda x: x['age']))
print("
")
 
PREVIOUS NEXT
Tagged: #sort #dictionary #ascending #order #sorted #lambda #function #python
ADD COMMENT
Topic
Name
9+5 =