Below this line, add a link to the EXACT exercise that you are stuck at.

In what way does your code behave incorrectly? Include ALL error messages.

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

What do you expect to happen instead?
It should loop through again?

def remove_duplicates(lst):
    new_lst = []
    for i in lst:
        if i in lst not in new_lst:
        print new_lst
        return new_lst
remove_duplicates([4, 5, 5, 4])


You already stated i in lst in your for loop. You don't need in lst anymore.

These two should be outside the loop. Function stops at return. If your return is inside the loop, it will only loop once and stops so it will never loop more than once.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.