Back to Lesson
Safe Deduplication
Cleanse lists dynamically to form reliable baselines.
Instructions
- Given
inventory = ["apple", "pear", "apple", "banana", "pear", "orange"] - Create a tracking set () and an output list (
seen = set()).unique_inv = [] - For each item, if it's not in, add it to both
seenandseen.unique_inv - Printto see the ordered deduction.
unique_inv
main.py
main.py
Ctrl + Enter