An AI assistant drafted the shopping-cart total below for an online store. It runs, but the acceptance checks fail.
Your job is the one an engineer actually does with AI-written code: work out what it got wrong, and fix it.
Two behaviours are wrong:
- The total ignores how many of each item are in the cart (the quantity).
- The discount is meant to be a percentage, but it is subtracted as a flat amount.
Press Run to see the checks fail, then fix cart_total so all of them pass. Keep the function signature unchanged.
You have an AI assistant available. Use it however you normally would - how you direct it and whether you check its answers is part of what we look at.