all problems

Unique values, order preserved

pythoneasysetslists

Write dedupe(items) that returns a new list with duplicates removed while keeping the first-seen order.

hint ladder

solution.py
loading editor…
step inspector

Inspect a chained expression (df.query(…).groupby(…).agg(…)) to see the shape and preview after each step.

output

Run your code to see its output, or check your solution to grade it.

Reference solution

The shape we check against. Any implementation that passes the assertions is valid — this one favours clarity.

def dedupe(items):
    seen = set()
    out = []
    for x in items:
        if x not in seen:
            seen.add(x)
            out.append(x)
    return out

Code is blurred until you solve this problem — the reasoning stays readable.