Code not working


def remove_duplicates(numbers):
for i in range(len(numbers)):
for k in range(i+1,len(numbers)):
if (numbers[k]==key):
print numbers



pop/remove/del is a bad idea to solve this problem because of index shift

I recommend adding the numbers to a new list, you could use something like: if .. not in .., which allows you to check if a number is already in the list


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.