diff --git a/lab-python-data-structures.ipynb b/lab-python-data-structures.ipynb index 5b3ce9e0..ab230d42 100644 --- a/lab-python-data-structures.ipynb +++ b/lab-python-data-structures.ipynb @@ -9,6 +9,45 @@ "# Lab | Data Structures " ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "products= {\"t-shirt\", \"mug\", \"hat\", \"book\", \"keychain\"}\n", + "inventory= {}\n", + "for product in products:\n", + " quantity= int(input(f\"Enter quantity for {product}: \"))\n", + " inventory[product] = quantity\n", + " customer_orders = set ()\n", + " for i in range (3):\n", + " product_name = input(\"Enter a product to order: \")\n", + " customer_orders.add(product_name)\n", + " print(\"\\nCustomer Orders:\")\n", + " for item in customer_orders:\n", + " print (item)\n", + "\n", + "total_products_ordered = len(customer_orders)\n", + " \n", + "percentage_ordered = (total_products_ordered / len(products)) * 100\n", + "\n", + "order_status = (total_products_ordered, percentage_ordered)\n", + "print(\"\\nOrder Statistics:\")\n", + "print(f\"Total Products Ordered: {order_status[0]}\")\n", + "print(f\"Percentage of Products Ordered: {order_status[1]}%\")\n", + "\n", + "for product in inventory:\n", + " inventory [product -= 1]\n", + "print(\"nUpdated Inventory:\")\n", + "for product, quantity in inventory.items():\n", + " print(f\"{product}: {quantity}\")\n", + "\n", + " print(\"\\nUpdated Inventory:\")\n", + " for product, quantity in inventory.items():\n", + " print(f\"{product}: {quantity}\")\n" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -54,7 +93,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "Python 3", "language": "python", "name": "python3" }, @@ -68,7 +107,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.14.2" } }, "nbformat": 4,