Relative order of elements in list
This can be written as a list comprehension like this:
lst = [1, 5, 4]
s = sorted(lst)
[s.index(x) for x in lst]
=> [0, 2, 1]
And here's another test, using @frb's example:
lst = [10, 2, 3, 9]
s = sorted(lst)
[s.index(x) for x in lst]
=> [3, 0, 1, 2]
Here's another go that should be more efficient that keeping .index
'ing into the list as it's stated that no duplicate values will occur, so we can do the lookup O(1) instead of linear... (and actually meets the requirements):
>>> a = [10, 2, 3, 9]
>>> indexed = {v: i for i, v in enumerate(sorted(a))}
>>> map(indexed.get, a)
[3, 0, 1, 2]