# 14. Remove_duplicates - I can go to next lesson, but code isn't doing what it's supposed to

#1

I was doing this exercise and looked around at the forums to get some help, and i have this code now. When I call the function like this -

``print remove_duplicates([1,1,2,3,3])``

it returns -

``````[1, 2, 3]
None``````

Then i can go to the next exercise even though it didn't just return duplicates. My code is below. What can i change to do this correctly?

``````def remove_duplicates(x):
loop = []
for i in x:
if i not in loop:
loop.append(i)
return loop
print remove_duplicates([1,1,2,3,3])``````

#2

Or is this exercise only for lists that have duplicates?

#3

your code is fine? the purpose of the exercise is to return a list which no longer contains duplicates. if a number occurred multiply times, only one of this instances should be in the list returned, which your code does perfectly

it is not suppose to cleanse the list completely from numbers which occur multiply times

#4

Oh! i thought it was only supposed to return the numbers that had duplicates. That makes so much more sense. Thanks

#5

well, nothing is stopping you from writing such a program, but it was not the purpose of this exercise/program

#6