Remove_duplicates: list index out of range error


I'm stuck at the remove_duplicates exercise.I am getting the right output in the console but can't progress to the next stage

This is the piece of code that i have written. Is there any issues with the same?

def remove_duplicates(sequence):
    for i in sequence:
        if i not in new_sequence:
    return new_sequence


do not assign the first item of sequence list to new_sequence


@fari123 is right, this line:


causes the error, the lesson also test if your code works for an empty list. then the above line of code causes an error message (since there is no index 0 )

the for loop and if condition can perfectly handle it.


thank you :slight_smile: