You can download this code by clicking the button below.
This code is now available for download.
Sorts a list based on a key provided in a dictionary, where the dictionary's keys are the elements of the list and the values are the sorting criteria.
Technology Stack : Built-in function sorted, lambda expression
Code Type : Sort function
Code Difficulty : Intermediate
def aordiff(arg1, arg2):
if arg1 is None or arg2 is None:
return None
return sorted(arg1, key=lambda x: arg2[x])