🛒 Supermarket Trolley · Mission 7 of 7
👑 Budget Shopping
Boss mission! Rahul has Rs 100. He can buy anything on the shelves, but he can't spend more than he has.
Your mission
- Make products = ["apple", "bread", "milk", "rice", "chips", "juice"], prices = [20, 35, 25, 60, 15, 30], budget = 100, cart = [] and total = 0.
- Ask "Item number? (0 to finish)" again and again, until the answer is 0.
- If it still fits the budget: put it in the trolley and add its price. If not: say "Not enough money for <item>!"
- At the end, say "Total: Rs <total>, change: Rs <change>".
Getting the mission ready…