Can someone please help me take a look what is wrong in my code. The message below keep popping up when I submit the code.
"Oops, try again. Your remove_duplicates modifies the list that was passed to it. [4, 5, 5, 4] was modified to [4, 4, 5, 5]. Perhaps you should make a copy first!"
However, when I input [4, 5, 5, 4] into the function, I am getting the right answer returning [4, 5]. Thanks in advance!
def remove_duplicates(lst): lst.sort() new_list =  for i in range(len(lst)): if i == 0: new_list.append(lst[i]) elif lst[i] != lst[(i-1)]: new_list.append(lst[i]) return new_list