Five lessons in decisions and loops. Which one surprised you most?
Day 13 — try/except. The idea that a function could try something and have a Plan B if it fails was new to me. It felt grown-up.
It is. That pattern separates code that works on clean data from code that survives in the real world. You'll reach for it every time you touch a file or a user input. Let's see what else stuck.
Ready.
Six questions, all pulled straight from this week's code. The explainer below has the recap when you're done.
is_over_budget — comparisons return booleans; return them directlyclassify_expense — if/elif/else ordered from smallest range to largesttotal_expenses — accumulator: initialize, loop-and-update, returnsafe_parse_amount — try/except (ValueError, TypeError) with None fallbackcount_over_limit — accumulator + if filter — same shape, different updateFive shapes that power the rest of the track.
Five lessons in decisions and loops. Which one surprised you most?
Day 13 — try/except. The idea that a function could try something and have a Plan B if it fails was new to me. It felt grown-up.
It is. That pattern separates code that works on clean data from code that survives in the real world. You'll reach for it every time you touch a file or a user input. Let's see what else stuck.
Ready.
Six questions, all pulled straight from this week's code. The explainer below has the recap when you're done.
is_over_budget — comparisons return booleans; return them directlyclassify_expense — if/elif/else ordered from smallest range to largesttotal_expenses — accumulator: initialize, loop-and-update, returnsafe_parse_amount — try/except (ValueError, TypeError) with None fallbackcount_over_limit — accumulator + if filter — same shape, different updateFive shapes that power the rest of the track.