My task is to use a set to convert a list of duplicates to a list of unique numbers. However, I want to retain the positions.
Simple enough I thought; so I made a dictionary that first stores the original list's positions.
def get_positions(a): 
    positions = {}
    for ele in a: 
        if not ele in positions:
            positions[ele] = a.index(ele) 
    return positions
So lets say I have a list a = [1, 2, 4, 4, 5]
Positions will give me a dictionary of {0:1, 1:2, 2:4, 3:4, 4:5}.
This however was unsuccessful because I repeated numbers will not get their positions stored.
Is there a way of achieving this?
Thanks.
UPDATE:
It seems I wasn't clear. I need to use a set. So, I get a list a=[1,2,4,4,5] and I must convert it to a set to erase the duplicates. Then, I need to get a list with the elements in the same order. (It's an assignment problem)
 
     
     
     
     
     
    