Exerpad
🔥0
0 XP
Lv.1 Beginner
Log In

Update Inventory

You start with this inventory:

python
inventory = {"apples": 5, "bananas": 3}

Read an item name and a quantity from input. If the item already exists, add the quantity to it. If it's a new item, add it to the inventory.

Print all items and quantities sorted alphabetically.

Example: if input is apples and 2:

text
apples: 7
bananas: 3

💡 Hints

?Hint 1
🔒Hint 2
🔒Hint 3
python