I have a list of items that I need to sort according to a given score I give it. The code looks something like this:
original_list = [item_1, item_2, item_3]
# ... Here I score the list in a separate function to get a score for each item ...
scored_list = [[35, item_1], [45, item_2], [1, item_3]]
scored_list.sort()
sorted_list = [item[1] for item in scored_list]
So I have a list of items, score each item, sort the list according to the score, and then remove the score variable to keep only the items.
Is this the most efficient way of doing this kind of operation, or are there simpler ways to obtain the same result?