Some questions can only be answered after seeing the whole list: "which is the first element that appears only once?" Looking at the first element you cannot know whether it repeats later.
count = {}for v in values:count[v] = count.get(v, 0) + 1for i, v in enumerate(values):if count[v] == 1:return ireturn -1
It matters that the second pass runs over the list and not over the dictionary: the word "first" means the order in the list.