14/15: code not working, what's wrong?


#1

What's wrong?

def remove_duplicates(num):

new = []

for i in num:
    for c in new:
        if i == c:
            break
        else:
            new.append(i)
return new

#2

I ran the code myself, and what I got is that int is not iterable. That means that your value num, can't be iterated over.
Quick fix would be to turn num into a string, using str()
for i in str(num):

That's as far as I got so far. Hope that helped?


#3

It works for me!

def remove_duplicates(n):
    newlist=[]
    for i in n:
        if i not in newlist:
            newlist.append(i)
    return newlist