ORIGINAL BRIEF · Python
Make a messy file understandable
Write a program that reads fictional expense rows and produces a useful category summary. The point is input handling and reliable behavior, not personal financial advice.
THE FINISHED THING
A program, a short runbook and tests for ordinary and broken input. Source files stay unchanged.
The boundaries
- Read a CSV with id, date, category and amount.
- Never overwrite or delete the input.
- Treat repeated IDs as duplicates, not new spending.
- Report invalid rows with a useful explanation. Do not silently turn invalid amounts into zero.
Start with the sample.
Original fictional data, provided under CC0. It is not a real-world dataset.
Download expenses.csvCheck your work
- The valid sample totals 48.75 and contains four distinct records.
- Duplicate record r2 is counted once and reported.
- The row with amount "unknown" is rejected clearly.
- A blank file and a missing amount column fail with clear messages.
- A test proves the source file is unchanged.
THE PART A SCREENSHOT CAN’T SHOW
Explain your decisions.
- Which input did you reject and why?
- How did you avoid rounding surprises?
- What would need to change before this handled real information?
Use and adapt this original practice brief. Do not present copied work as your own or submit a provided solution to a graded course. Keep private information out of public evidence links.