I have a list of integers, for example:
my_list = [5, 2, 4, 9]
I want a list containing the position where each element would appear in the list if it were sorted. So in the example above, I want this result:
>>> sorted(my_list)
[2, 4, 5, 9]
>>> magnitude(my_list)
[2, 0, 1, 3]
... because after sorting:
5ends up in position22ends up in position04ends up in position19ends up in position3
How can I do that?