Remove duplicates


#1

my code works (in another editor). Here not. Why?

def remove_duplicates(lista):
    new_lista=lista
    for x in range(len(lista)):
        for i in range(x+1,len(lista)):
            if lista[x]==lista[i]:
                new_lista[i]=""
    
    finale=[]
    
    for item in new_lista:
        if item!="":
            finale.append(item)
    
    return finale

#2

this:

new_lista=lista

will not make a copy of a list. either use a loop and append each element, or use the built in list() function

the exercise doesn't allow to modify the original list


#3

...got it... solved. tnx a lot!


#4