When I run the code it gives me
Oops, try again. remove_duplicates([4, 5, 5, 4]) resulted in an error: list assignment index out of range
and yet in the console window it shows the list being returned correctly. I was expecting i could simplify the process by first checking my own list to see if the number had already been added and if so remove the number. The console shows that I was correct but the error says otherwise.
Would someone mind explaining to me what I'm doing wrong? Did I use the wrong syntax?
def remove_duplicates(items): results =  for i in items: if i in results: del items[i] elif i not in results: results.append(i) return results print remove_duplicates([1,1,2,2,3,3,4,4,5,5])