You can loop through a list and sum it. Week 3 is the next layer — finding the biggest item, picking out the ones that match, sorting them, and turning many numbers into one summary.
Does each function I build this week stand alone, or do they chain?
Both, and they're designed to chain. Day 17 finds the max. Day 18 filters by category. Day 19 sorts by amount. Day 20 builds a per-category totals dict. Day 21 averages a list. By Friday you could wire four of them together and have something that already looks like a real report pipeline.
So this is the first week where functions feed each other?
Yes. You'll notice it on Day 20 — the dict you produce there is the exact input shape for next week's sort. And on Day 21, the averaging pattern is the same guard-then-compute shape you'll see in Day 26's savings rate. The pieces snap together on purpose.
find_highest_expense(amounts) — the max patternfilter_by_category(txns, cat) — list comprehension with an ifsort_by_amount(txns) — sorted() with key= and reverse=Truecategory_totals(txns) — dict accumulator grouped by keymonthly_average(amounts) — sum()/len() with an empty-list guardGoal: many transactions, one answer.
7 lessons this week
You can loop through a list and sum it. Week 3 is the next layer — finding the biggest item, picking out the ones that match, sorting them, and turning many numbers into one summary.
Does each function I build this week stand alone, or do they chain?
Both, and they're designed to chain. Day 17 finds the max. Day 18 filters by category. Day 19 sorts by amount. Day 20 builds a per-category totals dict. Day 21 averages a list. By Friday you could wire four of them together and have something that already looks like a real report pipeline.
So this is the first week where functions feed each other?
Yes. You'll notice it on Day 20 — the dict you produce there is the exact input shape for next week's sort. And on Day 21, the averaging pattern is the same guard-then-compute shape you'll see in Day 26's savings rate. The pieces snap together on purpose.
find_highest_expense(amounts) — the max patternfilter_by_category(txns, cat) — list comprehension with an ifsort_by_amount(txns) — sorted() with key= and reverse=Truecategory_totals(txns) — dict accumulator grouped by keymonthly_average(amounts) — sum()/len() with an empty-list guardGoal: many transactions, one answer.