remove_duplicates: Conditions on input!


#1

Hi there! I just wrote the function for remove_duplicates. Now, the function works fine, my question to you is: how would I tell the function to accept only lists? (Or for that matter, only integers, only strings etc.)?

If you want to take a loot at how I wrote it, here it is:

def remove_duplicates(m):
    n=[]
    for x in m:
        if x not in n:
            n.append(x)
        
    return n

#2

You may use type()

e.g.

def remove_duplicates(m):
    if type(m) == list:
        #your code