checkout(items, total) that asserts two invariants before returning the confirmation string 'charged <total>': the cart is non-empty, and total is positive. Each assert must carry a message. (Note for discussion: asserts vanish under python -O, so they guard developer errors, not user input.)checkout(['pen'], 10)
'charged 10'
Both invariants hold.
assert items, 'empty cart'.
assert total > 0 with its own message.