You have been writing functions since Day 3 — but they have been small, single-purpose tools. What happens when you want to combine them into a monthly invoice run you can hand to a colleague?
I would need to document them. Add parameters with defaults. Make sure the output is predictable. Right now they are just code in a file.
That is exactly what this week teaches. Default arguments, docstrings, tuple returns, file reading — the habits that turn throwaway scripts into reusable invoice templates. A function with a good docstring is a delivery template: write it once, use it every month, explain it to a non-technical client if needed.
And reading files — does Python actually open a CSV from disk?
In the sandbox, file contents come in as string arguments — a clean, testable pattern. The function reads the same way whether the string came from disk, an email attachment parser, or your time-tracker API. Day 19 covers reading, Day 20 uses csv.DictReader, Day 21 serialises to JSON. By the end you have a pipeline that takes a CSV export and produces a JSON report.
make_invoice_line: a named function with a docstring, rank parameter, and stats dict inputsummarize_client: default arguments and tuple unpacking — one function, two modesparse_client_csv: read CSV text as a string, split rows, parse fieldsload_clients_from_csv: replace manual splitting with csv.DictReader + io.StringIOclients_to_json: serialise the status summary to a JSON string with json.dumpsGoal: by Friday, your invoice functions are documented, composable, and ready to accept real export data.
7 lessons this week
You have been writing functions since Day 3 — but they have been small, single-purpose tools. What happens when you want to combine them into a monthly invoice run you can hand to a colleague?
I would need to document them. Add parameters with defaults. Make sure the output is predictable. Right now they are just code in a file.
That is exactly what this week teaches. Default arguments, docstrings, tuple returns, file reading — the habits that turn throwaway scripts into reusable invoice templates. A function with a good docstring is a delivery template: write it once, use it every month, explain it to a non-technical client if needed.
And reading files — does Python actually open a CSV from disk?
In the sandbox, file contents come in as string arguments — a clean, testable pattern. The function reads the same way whether the string came from disk, an email attachment parser, or your time-tracker API. Day 19 covers reading, Day 20 uses csv.DictReader, Day 21 serialises to JSON. By the end you have a pipeline that takes a CSV export and produces a JSON report.
make_invoice_line: a named function with a docstring, rank parameter, and stats dict inputsummarize_client: default arguments and tuple unpacking — one function, two modesparse_client_csv: read CSV text as a string, split rows, parse fieldsload_clients_from_csv: replace manual splitting with csv.DictReader + io.StringIOclients_to_json: serialise the status summary to a JSON string with json.dumpsGoal: by Friday, your invoice functions are documented, composable, and ready to accept real export data.