Sorting List by Dictionary Values

  • Share this:

Code introduction


Sorts a list based on the values in a dictionary for each element.


Technology Stack : sorted, lambda

Code Type : Sort function

Code Difficulty : Intermediate


                
                    
def aord_list(arg1, arg2):
    return sorted(arg1, key=lambda x: arg2[x])                
              
Tags: