Round money at an explicit boundary
Binary floating point cannot represent many decimal prices exactly. Decimal constructed from text preserves the intended value. A billing rule also needs to say when rounding happens: rounding each line can differ from rounding the final total. In this exercise, add exact line amounts first and round the invoice once, using half-up rounding.
from decimal import Decimal
print(Decimal("0.10") + Decimal("0.20"))Think before coding
The representation and the rounding policy are separate decisions. Decimal keeps the exact input prices, and one final quantize applies the invoice rule consistently. Work through the example by hand before changing the starter. Decide what should happen for an empty input, a single value and a repeated value where those cases apply. The checks use several inputs so a hard-coded answer cannot stand in for the rule.
Your task
Write invoice_total(lines). Each line is (unit_price_text, quantity). Sum using Decimal, then quantize once to two decimal places with ROUND_HALF_UP. Return a Decimal, including Decimal("0.00") for no lines.
The explanation opens here once every check passes.