14/15 remove dupliicates. This is enough to pass the exercise, but is it good/efficient/sound code?


I’ve noticed a trend wherein a flaw within the codecademy system seems to make it so that even if the code itself isn’t actually “correct”, it will still accept it and let you move onto the next exercise, so long as it seems to satisfy the MAIN part of the task. So it gives the user a false sense of satisfaction that actually leads to their own detriment, as they are moving on while not actually having created a sound piece of code.

Is this the case with me in this exercise? I feel like it’s too simple, but idk. Maybe it is correct?

def remove_duplicates(list):
  list_two = []
  for x in list:
    if x not in list_two:
  print list_two
  return list_two



Just leave it out

This will search through the whole list, it would be more efficient to use a data structure that can tell you if it contains the value or not without comparing to all its contained values

Is the purpose to print, or to return? Don’t do both.


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