Adding and updating key-value pairs
๐ Scenario: You are managing a small store's inventory. You need to keep track of the products and their quantities using a dictionary.
๐ฏ Goal: Create a dictionary with initial products and quantities, add a new product, update the quantity of an existing product, and then display the final inventory.
๐ What You'll Learn
Create a dictionary called
inventory with exact products and quantitiesAdd a new product with a specific quantity to
inventoryUpdate the quantity of an existing product in
inventoryPrint the final
inventory dictionary๐ก Why This Matters
๐ Real World
Managing inventory is a common task in stores and warehouses to keep track of product quantities.
๐ผ Career
Knowing how to add and update key-value pairs in dictionaries is essential for data management and software development.
Progress0 / 4 steps