My solution looking for improvement


#1

Looking for improvement i’d love to get feed back, and see what you came up with



def remove_duplicates(dup):
  dump = []
  dup_free = []
  for num in dup:
    if num not in dump:
      dump.append(num)
      dup_free.append(num)
  return dup_free    
    
      
    
print remove_duplicates([1,1,2,2,3,1,2,1,2,12]) 



#2

why do you have 2 lists? Either get rid of dup_free and return dump or get rid of dump and do if num not in dup_free


#3

I thought i needed a list to keep track of what was already in my list but yeah ^^ it doesn’t make much sens now that I think about it


#4

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