14.remove duplicates


#1



https://www.codecademy.com/fr/courses/python-intermediate-fr-FR-py0yl/2/4?curriculum_id=5370f030fed2a866a2000001#


Hi everyone
I tried this code on exercise 14 of prectice makes it perfect and t didn't work. I can't figure out why even if it is maybe a dumb error that I did.
do you have any advces ?
(I work on the french version so maybe the name aren't the same as in english but it's the same method)
thanks
dan


def supprimer_doublons(nombres):
    sansdoublons=""
    for i in nombres:
        if i not in sansdoublons:
            sansdoublons.append(i)
    nombres=sansdoublons
    return nombres
    
    
print supprimer_doublons([1,2,2])


#2

sansdoublons should be a list, not a string.

sansdoublons=[]

#3

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