Broke my brains and can't find an error 14._remove_duplicates

def remove_duplicates(numbers):
    no_duplicates = []   
    for i in numbers:
        if i not in numbers:
           no_duplicates.append(i)
    return no_duplicates
    
print remove_duplicates([1,1,2,2,3,4,5,5,6]) here

That is what I get as a return:

Oops, try again. remove_duplicates([4, 5, 5, 4]) returned instead of [4, 5]

If Someone sees what is wrong, I will be very very grateful!

1 Like

here:

if i not in numbers:

numbers contains all values, so this will always be false? You want to check if i is not yet in no_duplicates

2 Likes

Thank you thank you!!! I haven’t noticed that I typed numbers there… So ■■■■. :slight_smile:
Issue is resolved!

1 Like