diff --git a/lab-python-data-structures.ipynb b/lab-python-data-structures.ipynb index 5b3ce9e0..68b5940f 100644 --- a/lab-python-data-structures.ipynb +++ b/lab-python-data-structures.ipynb @@ -9,6 +9,56 @@ "# Lab | Data Structures " ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Step 1\n", + "products = [\"t-shirt\", \"mug\", \"hat\", \"book\", \"keychain\"]\n", + "\n", + "# Step 2\n", + "inventory = {}\n", + "\n", + "# Step 3\n", + "for product in products:\n", + " quantity = int(input(f\"Enter the quantity available for {product}: \"))\n", + " inventory[product] = quantity\n", + "\n", + "# Step 4\n", + "customer_orders = set()\n", + "\n", + "# Step 5\n", + "for i in range(3):\n", + " product = input(\"Enter a product to order: \")\n", + " customer_orders.add(product)\n", + "\n", + "# Step 6\n", + "print(customer_orders)\n", + "\n", + "# Step 7\n", + "total_products_ordered = len(customer_orders)\n", + "percentage_ordered = (total_products_ordered / len(products)) * 100\n", + "\n", + "# Step 8\n", + "order_status = (total_products_ordered, percentage_ordered)\n", + "\n", + "# Step 9\n", + "print(\"Order Statistics:\")\n", + "print(\"Total Products Ordered:\", total_products_ordered)\n", + "print(\"Percentage of Products Ordered:\", percentage_ordered, \"%\")\n", + "\n", + "# Step 10\n", + "for product in customer_orders:\n", + " inventory[product] -= 1\n", + "\n", + "# Step 11\n", + "print(\"Updated Inventory:\")\n", + "for product, quantity in inventory.items():\n", + " print(product, \":\", quantity)" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -68,7 +118,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.12.6" } }, "nbformat": 4,