
Boss
Boss: The Supply Depot

Boss Fight!
Every passing test breaks a shield.
The Supply Depot on Harbor Island keeps every lantern in the archipelago fuelled, and today the quartermaster is off sick. A stack of orders has arrived, and you're in charge!
Each order is a tuple (action, item, qty). Process them in order:
"add": increase that item's stock byqty. New items start from 0."take": if there is at leastqtyin stock, subtract it. If the stock reaches exactly0, delete the item fromstock. If there isn't enough (or the item doesn't exist), don't change anything, append the item's name toshortagesinstead.
Assignment
- Process every order to update
stockandshortages. - Build
low_stock: a set of items with fewer than3left. - Count
total_items: all quantities instockadded up. - Print the report exactly like this:
=== Depot Report ===
lantern oil: 10
map: 1
rope: 3
Shortages: lantern oil, compass
Low stock: map
Items in depot: 14
Items are listed in alphabetical order (sorted(stock) gives you
the keys sorted). Use ", ".join(...) for the comma lists.
- Process every order to update
stockandshortages. - Build
low_stock: a set of items with fewer than3left. - Count
total_items: all quantities instockadded up. - Print the report exactly like this:
=== Depot Report ===
lantern oil: 10
map: 1
rope: 3
Shortages: lantern oil, compass
Low stock: map
Items in depot: 14
Items are listed in alphabetical order (sorted(stock) gives you
the keys sorted). Use ", ".join(...) for the comma lists.
main.py Python sleeping
Press Run to try your code, then Check to test it.