Python. Practice Makes Perfect, 14 remove_duplicates


#1

Hi,

this code works fine but it doesn't meet the requirements.

def remove_duplicates(lst):
    result = 0
    for i in lst:
        result = lst.count(i)  
    return result
    
print(remove_duplicates([1, 3, 3, 1, 4]))

Requirement is

Write a function remove_duplicates that takes in a list and removes elements of the list that are the same.

For example: remove_duplicates([1,1,2,2]) 
should return [1,2].

#3

A corner case, well yes, it occurs.