My solution to "remove_duplicates"


#1

Hello,

This is my solution to the remove_duplicates lesson. Did you find a better one? Post it!

def remove_duplicates(nums):
  new_list = []
  new_list1 = []
  for i in nums:
    if i not in new_list:
      new_list.append(i)
      new_list1.append(i)
    elif i in new_list:
      pass
  return new_list1
    

Have a nice day!


#2

why do you have both new_list and new_list1? They seem to do the same thing

elif is absolutely not doing anything, you can get rid of it.


#3

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