Note: I understand this looks similar to a lot of questions, but wait just a second and finish reading.
Is there a way to sort a list by another where we do not have to merge the lists somehow?
items = ["a", "b", "c", "d", "e"]
minutes_ago = [1, 3, 2, 5, 4]
Result should be that the items
are sorted by the minutes_ago
list. What's the optimised way to do so?
I was thinking of some sorted(items, key = lambda ... )
but then couldn't imagine how to solve it nicely.
Out:
items = ["a", "c", "b", "e", "d"]