Five more lessons. You can now find the biggest, pick out the matches, rank them, group them, and average them. Which one surprised you most?
Day 20 — watching .get(cat, 0.0) handle both the first-time case and the running case in one line. It felt like the dict was cooperating with me.
That one expression is worth the whole week. Once it's in your muscle memory, every aggregation problem gets shorter. Let's see what else stuck.
Hit me.
Six questions pulled from this week. The explainer below has the full recap when you're done.
find_highest_expense — guard empty → champion from list[0] → replace on larger valuesfilter_by_category — [t for t in txns if t["category"] == cat]sort_by_amount — sorted(..., key=lambda t: t["amount"], reverse=True)category_totals — dict accumulator with .get(cat, 0.0) + amountmonthly_average — guard empty → sum(xs) / len(xs)Five aggregators, one consistent shape: guard → walk → return.
Five more lessons. You can now find the biggest, pick out the matches, rank them, group them, and average them. Which one surprised you most?
Day 20 — watching .get(cat, 0.0) handle both the first-time case and the running case in one line. It felt like the dict was cooperating with me.
That one expression is worth the whole week. Once it's in your muscle memory, every aggregation problem gets shorter. Let's see what else stuck.
Hit me.
Six questions pulled from this week. The explainer below has the full recap when you're done.
find_highest_expense — guard empty → champion from list[0] → replace on larger valuesfilter_by_category — [t for t in txns if t["category"] == cat]sort_by_amount — sorted(..., key=lambda t: t["amount"], reverse=True)category_totals — dict accumulator with .get(cat, 0.0) + amountmonthly_average — guard empty → sum(xs) / len(xs)Five aggregators, one consistent shape: guard → walk → return.