diff --git a/lab-python-data-structures.ipynb b/lab-python-data-structures.ipynb index 5b3ce9e0..21bb91b5 100644 --- a/lab-python-data-structures.ipynb +++ b/lab-python-data-structures.ipynb @@ -50,6 +50,49 @@ "\n", "Solve the exercise by implementing the steps using the Python concepts of lists, dictionaries, sets, and basic input/output operations. " ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "vscode": { + "languageId": "plaintext" + } + }, + "outputs": [], + "source": [ + "products[\"t-shirt\", \"mug\", \"hat\", \"book\", \"keychain\"]\n", + "inventory = {}\n", + "print(\"Enter the quantity for each product in inventory: \")\n", + "for product in products:\n", + " quantity = int(input(f\"Quantity of {products}: \"))\n", + " inventory[product] = quantity\n", + "\n", + "customer_orders = set()\n", + "\n", + "for i in range(3):\n", + " order = input(f\"Enter the name of product {i+1} to order (t-shirt, mug, hat, book, keychain): \")\n", + " customer_orders.add(order)\n", + "\n", + "print(\"Customer orders: customer_orders\")\n", + "\n", + "total_products_ordered = len(customer_orders)\n", + "percentage_ordered = (total_products_ordered / len(products)) * 100\n", + "\n", + "order_status = (total_products_ordered, percentage_ordered)\n", + "\n", + "print(f\"\"\"\n", + "Order Statistics: \n", + "Total Products Ordered: \n", + "Percentage of Products Ordered: %\"\"\")\n", + "\n", + "for product in customer_orders:\n", + " inventory[product] -= 1\n", + "\n", + "print(\"Updated Inventory: \")\n", + "for product, quantity in inventory.items():\n", + " print(f\"{product}: {quantity}\")" + ] } ], "metadata": {