Lists · Intermediate · 60 XP · about 7 min
Write a function called remove_duplicates(lst) that returns a new list with duplicate elements removed, preserving the original order.
remove_duplicates([1, 2, 2, 3, 1, 4]) # Returns [1, 2, 3, 4] remove_duplicates(["a", "b", "a", "c"]) # Returns ["a", "b", "c"] remove_duplicates([1, 1, 1]) # Returns [1]
Ready?
Accept the challenge to start writing. A small timer counts the time this page is in view.
Output appears here.