remove duplicates

mail@pastecode.io avatar
unknown
plain_text
a year ago
355 B
2
Indexable
Never
def remove_duplicates(lst):
    frequency={}
    new_lst=[]
    for i in lst:
        if i in frequency:
            frequency[i]+=1
        else:
            frequency[i]=1
    for i in lst:       
        if frequency[i]==1:
            new_lst.append(i)
    return new_lst
    
            


print(remove_duplicates([4,3,5,2,5,1,3,5]))