Log inBook a Demo
DebugJuniorBackendAuto-graded

Fix invoice totals that drift by a cent

Finance found invoice totals off by a cent; make every amount exact and round half-up, keeping the same signatures.billing.py totals invoices: line totals, a percentage tax and a flat discount. Finance says the numbers are a cent out. A $2.045 line comes out as 2.04, and the sample invoice totals 149.01 where the hand total is 149.02. Every amount should be correct to the penny, rounding half-up on the half-cent. Keep the function signatures and the money-string return type.
25 min
python

What it measures

PythonWriting numeric code that returns the exact amount every time.
Debugging and profilingFinding where a one-cent difference comes from and fixing it there.
Care with moneyTreating the rounding rule, and when rounding happens, as part of the spec.

Your environment

Terminal + editorA full shell in the browser
Coding agentAlready signed in, no API key to set up
Isolated workspaceOnly yours, wiped when you finish

Start this lab

25 min
Start labYou'll need to sign in to Anthropos first. The lab opens in a private cloud workspace with your coding agent ready to use.
AI Labs is part of Anthropos Workforce. Not on your plan yet? Book a demo