← Questions

Shopping cart pricing with category coupons

0
Applied IntuitionCodingLast asked Sep 2025

A shopping cart holds items, each with a category and a price. A coupon names a category and gives a percentage or amount off, and it applies only when the cart meets its conditions: a minimum number of items and a minimum total price (in that category). Model items, the cart and coupons, and write the function that computes the cart's final price with the coupons applied. Discuss how you would add new coupon rules without rewriting the pricing code, and how several coupons interact.

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding