Please help, im stuck here for too long


error: list out of range

I do whatever the hint told me and the result was right. I don't know what is wrong here

def count(x, j):
    for i in x:
        if i == j:
            return True
        return False

def remove_duplicates(x):
    z = [x[0]]
    for i in range(1, len(x)):
        if count(z, x[i]) == False:
    return z
print remove_duplicates([1, 2, 2, 4, 5, 5, 4]).


There is simpler solution to this. Declare empty list z = [], iterate over x and if item is not in z just append it to your empty list z