i am new to python 2 and am learning. the following program to remove duplicate numbers from a list and return the new list with all duplicates removed is showing list index out of range. i don't know why?This the code for it. Can someone tell what is wrong?
def remove_duplicates(list1): list2 =  list2.append(list1) for i in range(0, len(list1)): if list1[i] not in list2: list2.append(list1[i]) return list2