Improvement in codes


#1

Hi everybody,
Can anyone of you provide me better code

def remove_duplicates(k):
    if k == []:
        return []
    new = []
    new.append(k[0])
    for d in range(len(k) - 1):
        for m in range(len(new)):
            if k[d + 1] == new[m]:
                break
        else:
            new.append(k[d + 1])
    return new

#2

look at the hint in the exercise, it tells you you can use not in, this way, you need only one loop, and can hugely reduce your code base


#3

thanks @stetim94
I forgot to look there before asking on the forum


#4

f you need more help, let me know