Aggregate sales by product (ATBS Ch.13).
Read CSV from stdin: header is "product,qty,price". Print each product and its total revenue (qty*price), sorted by product name. Format: "<product>: <total>" with totals as integers when whole, else 1 decimal.
Test input:
product,qty,price
apples,10,1
bread,2,3
apples,5,1
bread,1,3
Expected output:
apples: 15
bread: 9
Sign in to save your code and track progress across devices.