Single item, no discount
Input
process_order([('Hat', 2500, 2)], 'card')
Output
(True, 5400)
Subtotal = 2500*2 = 5000. No discount. Tax = 8% of 5000 = 400. Total = 5400. Payment method 'card' is supported and amount > 0, so paid=True.
Full lesson preview
Model an e-commerce order using composition: products, cart items, cart aggregation, order calculation, and simple payment processing.
Problem statement
Task
Examples
Input
process_order([('Hat', 2500, 2)], 'card')
Output
(True, 5400)
Subtotal = 2500*2 = 5000. No discount. Tax = 8% of 5000 = 400. Total = 5400. Payment method 'card' is supported and amount > 0, so paid=True.
Input format
Output format
Constraints
Samples
Input
process_order([('Shoes', 7000, 1), ('Socks', 500, 2)], 'paypal')
Output
(True, 8640)
Subtotal = 7000 + (500*2)=8000. No discount. Tax = 640. Total = 8640. Payment succeeds with 'paypal'.