Say I have a dictionary and then I have a list that contains the dictionary\'s keys. Is there a way to sort the list based off of the dictionaries values?
The key argument in the sorted builtin function (or the sort method of lists) has to be a function that maps members of the list you're sorting to the values you want to sort by. So you want this: