Remove Duplicates, Keep Order

easy
Checkpoint challenge
Solve this to show you know the material and jump straight to Unit 6. Everything before it counts as cleared.

Implement dedupe(items, key=None) returning a list with only the first occurrence of each item, in original order. If key is given, two items are duplicates when key(item) is equal.

It must work for unhashable items (like dicts or lists) when a key that returns something hashable is supplied, and run in linear time.

#lists#sets2 visible + 1 hidden tests
solution.py · Python 3.13
Loading editor…
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Remove Duplicates, Keep Order · TechGradify