Remove Duplicates, Keep Order

easy
Unit 5 · Lists & Context Managers0/3 to milestone

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