Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 41 additions & 2 deletions lab-python-data-structures.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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": {},
Expand Down Expand Up @@ -54,7 +93,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
Expand All @@ -68,7 +107,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
"version": "3.14.2"
}
},
"nbformat": 4,
Expand Down