Sorting List by Dictionary Values

  • Share this:

Code introduction


Sorts a list based on the values of a dictionary


Technology Stack : List (list), Dictionary (dict), Lambda expression

Code Type : Function

Code Difficulty : Intermediate


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