$ ./guess_the_languageProblem Solving — fix the bug
Problem Solving — fix the bug · medium · #31

Which fix removes the bug?

def dedupe(items):
    seen = []
    for x in items:
        if x not in seen:
            seen.append
    return seen
  1. Change not in to in in the test
  2. Change seen.append to seen.append(x)
  3. Return items instead of the seen list
  4. Initialize seen as a set literal
append is referenced but never called with x.
Play Problem Solving ▸