Skip to content
Sharp

Core Collections · interview question

A bug appears around aggregation patterns. What is the strongest first debugging move?

Multiple choiceHardchapter-3-curatedpremiumcore-collectionsaggregation-patterns
python
orders = [{"region": "US"}, {"region": "EU"}, {"region": "US"}]
counts = {}
for order in orders:
    counts[order["region"]] = counts.get(order["region"], 0) + 1
print(counts)
Choose one answer
Answer and explanation

Correct answer

D. Trace one concrete example, inspect the state transitions, and compare them to the intended rule before rewriting anything.

Why

That approach is reliable because it creates evidence. Implicit aggregation logic tends to produce plausible but wrong summaries.

Test yourself on Core Collections

A free test with instant, explained results. No account needed.

Start free test
All Core Collections questions →