From 81a5c6d8944380caadde9ba813e6aad4ad780a84 Mon Sep 17 00:00:00 2001 From: arnaumatasfont-keky Date: Fri, 17 Apr 2026 17:00:46 +0200 Subject: [PATCH] Update lab-python-error-handling.ipynb --- lab-python-error-handling.ipynb | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/lab-python-error-handling.ipynb b/lab-python-error-handling.ipynb index 3e50ef8..52027f7 100644 --- a/lab-python-error-handling.ipynb +++ b/lab-python-error-handling.ipynb @@ -46,8 +46,36 @@ "metadata": {}, "outputs": [], "source": [ - "# your code goes here" + "# your code goes here\n", + "def initialize_inventory(products):\n", + " inventory = {}\n", + " for product in products:\n", + " quantity = int(input(f\"Enter the quantity for {product}: \"))\n", + " inventory[product] = quantity\n", + " return inventory\n", + "def get_costumers_orders():\n", + " costumers_order = set()\n", + " \n", + " add_product = \"yes\"\n", + " while add_product.lower() == \"yes\":\n", + " product = input(\"Enter the product name (t-shirt/pants/shoes/jacket): \").lower()\n", + " costumers_order.add(product)\n", + " add_product = input(\"Do you want to add another product? (yes/no): \").lower()\n", + " return costumers_order\n", + "def update_inventory(costumers_order, inventory):\n", + " for product in costumers_order:\n", + " if product in inventory:\n", + " inventory[product] -= 1\n", + " return inventory" ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c5f2f2", + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": {