inventory = {"apple": 10, "banana": 5} sales = ["apple", "apple", "banana"] for i in sales: if i in inventory: inventory[i] -= 1 print(inventory)
To embed this project on your website, copy the following code and paste it into your website's HTML: