From 04bac55eee01ff0bb263d96aaa76fcc44f6f9d4c Mon Sep 17 00:00:00 2001 From: Ou Hai Date: Mon, 17 Nov 2025 17:42:47 +0100 Subject: [PATCH 1/3] Solved lab --- lab-data-structures.ipynb | 264 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 264 insertions(+) create mode 100644 lab-data-structures.ipynb diff --git a/lab-data-structures.ipynb b/lab-data-structures.ipynb new file mode 100644 index 00000000..7b003ac2 --- /dev/null +++ b/lab-data-structures.ipynb @@ -0,0 +1,264 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 3, + "id": "9609ab30-a065-4c58-9f08-421931bc6e1e", + "metadata": {}, + "outputs": [], + "source": [ + "products= [\"t-shirt\", \"mug\", \"hat\", \"book\", \"keychain\"]" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "7ee2f55b-55ee-4fd0-ac42-fcfb36906f05", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['t-shirt', 'mug', 'hat', 'book', 'keychain']\n" + ] + } + ], + "source": [ + "print(products)" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "c3216fbf-fd4c-437c-aba6-3a575dda224a", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "list" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "type(products)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "d9f99365-5d23-41ba-8f5e-396fc37b46cb", + "metadata": {}, + "outputs": [], + "source": [ + "inventory={}" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "92a3f184-355e-477f-9cdd-21b666a046c2", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Please enter the quantity for each product:\n" + ] + }, + { + "name": "stdin", + "output_type": "stream", + "text": [ + "Quantity of {product}: 5\n", + "Quantity of {product}: 2\n", + "Quantity of {product}: 8\n", + "Quantity of {product}: 7\n", + "Quantity of {product}: 3\n" + ] + } + ], + "source": [ + "print(\"Please enter the quantity for each product:\")\n", + "for product in products:\n", + " quantity = int(input(\"Quantity of {product}: \"))\n", + " inventory[product] = quantity" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "651d46f7-9b9f-4575-9e99-7b120cd002f4", + "metadata": {}, + "outputs": [], + "source": [ + "customer_orders=set()" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "31ec7061-11cf-4919-a8c2-ff9890dcfaf6", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Please enter three products the customer wants to order:\n" + ] + }, + { + "name": "stdin", + "output_type": "stream", + "text": [ + "Product 1: t-shirt\n", + "Product 2: mug\n", + "Product 3: hat\n" + ] + } + ], + "source": [ + "print(\"Please enter three products the customer wants to order:\")\n", + "for i in range(3):\n", + " order = input(f\"Product {i+1}: \").strip().lower()\n", + " \n", + " # Check if product exists\n", + " while order not in products:\n", + " print(\"Invalid product, please choose from:\", products)\n", + " order = input(f\"Product {i+1}: \").strip().lower()\n", + " \n", + " customer_orders.add(order)" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "6542cad8-c1f9-4169-8ea8-2fb1fe7afa1f", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'hat', 't-shirt', 'mug'}\n" + ] + } + ], + "source": [ + "print(customer_orders)" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "id": "f98e9f8b-9b19-4a7c-97c3-7e49bfdc1add", + "metadata": {}, + "outputs": [], + "source": [ + "total_products_ordered = len(customer_orders)" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "id": "dd653a4c-284c-4e20-ab43-d31e916ed9cd", + "metadata": {}, + "outputs": [], + "source": [ + "percentage_ordered = (total_products_ordered / len(products)) * 100" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "id": "823ce3cb-96f4-455d-bb0c-0289d206e5d5", + "metadata": {}, + "outputs": [], + "source": [ + "order_status = (total_products_ordered, percentage_ordered)" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "id": "45d28cf3-2b4a-42b0-8667-c26bf90b9f4b", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Total Products Ordered: 3\n", + "Percentage of Products Ordered: 60.00%\n" + ] + } + ], + "source": [ + "print(f\"Total Products Ordered: {order_status[0]}\")\n", + "print(f\"Percentage of Products Ordered: {order_status[1]:.2f}%\")" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "id": "46441365-7771-4fe4-95f8-87eaaddaee3c", + "metadata": {}, + "outputs": [], + "source": [ + "for product in customer_orders:\n", + " inventory[product] -= 1" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "id": "820bff22-e3a0-42c6-a0f2-15e0e8651ae7", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "t-shirt: 4\n", + "mug: 1\n", + "hat: 7\n", + "book: 7\n", + "keychain: 3\n" + ] + } + ], + "source": [ + "for product, quantity in inventory.items():\n", + " print(f\"{product}: {quantity}\")" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python [conda env:base] *", + "language": "python", + "name": "conda-base-py" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.13.5" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} From b0671edee1d568751f81f7138136cd196465c076 Mon Sep 17 00:00:00 2001 From: Ou Hai Date: Thu, 20 Nov 2025 09:20:11 +0100 Subject: [PATCH 2/3] Sloved second time --- .../lab-data-structures-checkpoint.ipynb | 262 ++++++++++++++++++ ...ab-python-data-structures-checkpoint.ipynb | 76 +++++ lab-data-structures.ipynb | 68 ++--- lab-python-data-structures.ipynb | 6 +- 4 files changed, 378 insertions(+), 34 deletions(-) create mode 100644 .ipynb_checkpoints/lab-data-structures-checkpoint.ipynb create mode 100644 .ipynb_checkpoints/lab-python-data-structures-checkpoint.ipynb diff --git a/.ipynb_checkpoints/lab-data-structures-checkpoint.ipynb b/.ipynb_checkpoints/lab-data-structures-checkpoint.ipynb new file mode 100644 index 00000000..f4bc9497 --- /dev/null +++ b/.ipynb_checkpoints/lab-data-structures-checkpoint.ipynb @@ -0,0 +1,262 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 2, + "id": "9609ab30-a065-4c58-9f08-421931bc6e1e", + "metadata": {}, + "outputs": [], + "source": [ + "products= [\"t-shirt\", \"mug\", \"hat\", \"book\", \"keychain\"]" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "7ee2f55b-55ee-4fd0-ac42-fcfb36906f05", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['t-shirt', 'mug', 'hat', 'book', 'keychain']\n" + ] + } + ], + "source": [ + "print(products)" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "c3216fbf-fd4c-437c-aba6-3a575dda224a", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "list" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "type(products)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "d9f99365-5d23-41ba-8f5e-396fc37b46cb", + "metadata": {}, + "outputs": [], + "source": [ + "inventory={}" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "92a3f184-355e-477f-9cdd-21b666a046c2", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Please enter the quantity for each product:\n" + ] + }, + { + "name": "stdin", + "output_type": "stream", + "text": [ + "Quantity of t-shirt: 5\n", + "Quantity of mug: 6\n", + "Quantity of hat: 7\n", + "Quantity of book: 8\n", + "Quantity of keychain: 9\n" + ] + } + ], + "source": [ + "print(\"Please enter the quantity for each product:\")\n", + "for product in products:\n", + " quantity = int(input(f\"Quantity of {product}: \"))\n", + " inventory[product] = quantity" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "651d46f7-9b9f-4575-9e99-7b120cd002f4", + "metadata": {}, + "outputs": [], + "source": [ + "customer_orders=set()" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "31ec7061-11cf-4919-a8c2-ff9890dcfaf6", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Please enter three products the customer wants to order:\n" + ] + }, + { + "name": "stdin", + "output_type": "stream", + "text": [ + "Product 1: t-shirt\n", + "Product 2: mug\n", + "Product 3: hat\n" + ] + } + ], + "source": [ + "print(\"Please enter three products the customer wants to order:\")\n", + "for i in range(3):\n", + " order = input(f\"Product {i+1}: \").strip().lower()\n", + " while order not in products:\n", + " print(\"Invalid product, please choose from:\", products)\n", + " order = input(f\"Product {i+1}: \").strip().lower()\n", + " \n", + " customer_orders.add(order)" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "6542cad8-c1f9-4169-8ea8-2fb1fe7afa1f", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'hat', 't-shirt', 'mug'}\n" + ] + } + ], + "source": [ + "print(customer_orders)" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "id": "f98e9f8b-9b19-4a7c-97c3-7e49bfdc1add", + "metadata": {}, + "outputs": [], + "source": [ + "total_products_ordered = len(customer_orders)" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "id": "dd653a4c-284c-4e20-ab43-d31e916ed9cd", + "metadata": {}, + "outputs": [], + "source": [ + "percentage_ordered = (total_products_ordered / len(products)) * 100" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "id": "823ce3cb-96f4-455d-bb0c-0289d206e5d5", + "metadata": {}, + "outputs": [], + "source": [ + "order_status = (total_products_ordered, percentage_ordered)" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "id": "45d28cf3-2b4a-42b0-8667-c26bf90b9f4b", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Total Products Ordered: 3\n", + "Percentage of Products Ordered: 60.00%\n" + ] + } + ], + "source": [ + "print(f\"Total Products Ordered: {order_status[0]}\")\n", + "print(f\"Percentage of Products Ordered: {order_status[1]:.2f}%\")" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "id": "46441365-7771-4fe4-95f8-87eaaddaee3c", + "metadata": {}, + "outputs": [], + "source": [ + "for product in customer_orders:\n", + " inventory[product] -= 1" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "id": "820bff22-e3a0-42c6-a0f2-15e0e8651ae7", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "t-shirt: 4\n", + "mug: 1\n", + "hat: 7\n", + "book: 7\n", + "keychain: 3\n" + ] + } + ], + "source": [ + "for product, quantity in inventory.items():\n", + " print(f\"{product}: {quantity}\")" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python [conda env:base] *", + "language": "python", + "name": "conda-base-py" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.13.5" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/.ipynb_checkpoints/lab-python-data-structures-checkpoint.ipynb b/.ipynb_checkpoints/lab-python-data-structures-checkpoint.ipynb new file mode 100644 index 00000000..5b3ce9e0 --- /dev/null +++ b/.ipynb_checkpoints/lab-python-data-structures-checkpoint.ipynb @@ -0,0 +1,76 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "tags": [] + }, + "source": [ + "# Lab | Data Structures " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exercise: Managing Customer Orders\n", + "\n", + "As part of a business venture, you are starting an online store that sells various products. To ensure smooth operations, you need to develop a program that manages customer orders and inventory.\n", + "\n", + "Follow the steps below to complete the exercise:\n", + "\n", + "1. Define a list called `products` that contains the following items: \"t-shirt\", \"mug\", \"hat\", \"book\", \"keychain\".\n", + "\n", + "2. Create an empty dictionary called `inventory`.\n", + "\n", + "3. Ask the user to input the quantity of each product available in the inventory. Use the product names from the `products` list as keys in the `inventory` dictionary and assign the respective quantities as values.\n", + "\n", + "4. Create an empty set called `customer_orders`.\n", + "\n", + "5. Ask the user to input the name of three products that a customer wants to order (from those in the products list, meaning three products out of \"t-shirt\", \"mug\", \"hat\", \"book\" or \"keychain\". Add each product name to the `customer_orders` set.\n", + "\n", + "6. Print the products in the `customer_orders` set.\n", + "\n", + "7. Calculate the following order statistics:\n", + " - Total Products Ordered: The total number of products in the `customer_orders` set.\n", + " - Percentage of Products Ordered: The percentage of products ordered compared to the total available products.\n", + " \n", + " Store these statistics in a tuple called `order_status`.\n", + "\n", + "8. Print the order statistics using the following format:\n", + " ```\n", + " Order Statistics:\n", + " Total Products Ordered: \n", + " Percentage of Products Ordered: % \n", + " ```\n", + "\n", + "9. Update the inventory by subtracting 1 from the quantity of each product. Modify the `inventory` dictionary accordingly.\n", + "\n", + "10. Print the updated inventory, displaying the quantity of each product on separate lines.\n", + "\n", + "Solve the exercise by implementing the steps using the Python concepts of lists, dictionaries, sets, and basic input/output operations. " + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.13" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/lab-data-structures.ipynb b/lab-data-structures.ipynb index 7b003ac2..169ffa73 100644 --- a/lab-data-structures.ipynb +++ b/lab-data-structures.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 3, + "execution_count": 2, "id": "9609ab30-a065-4c58-9f08-421931bc6e1e", "metadata": {}, "outputs": [], @@ -12,7 +12,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 3, "id": "7ee2f55b-55ee-4fd0-ac42-fcfb36906f05", "metadata": {}, "outputs": [ @@ -30,7 +30,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 4, "id": "c3216fbf-fd4c-437c-aba6-3a575dda224a", "metadata": {}, "outputs": [ @@ -40,7 +40,7 @@ "list" ] }, - "execution_count": 5, + "execution_count": 4, "metadata": {}, "output_type": "execute_result" } @@ -51,7 +51,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 5, "id": "d9f99365-5d23-41ba-8f5e-396fc37b46cb", "metadata": {}, "outputs": [], @@ -61,7 +61,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 6, "id": "92a3f184-355e-477f-9cdd-21b666a046c2", "metadata": {}, "outputs": [ @@ -76,24 +76,24 @@ "name": "stdin", "output_type": "stream", "text": [ - "Quantity of {product}: 5\n", - "Quantity of {product}: 2\n", - "Quantity of {product}: 8\n", - "Quantity of {product}: 7\n", - "Quantity of {product}: 3\n" + "Quantity of t-shirt: 5\n", + "Quantity of mug: 6\n", + "Quantity of hat: 7\n", + "Quantity of book: 8\n", + "Quantity of keychain: 9\n" ] } ], "source": [ "print(\"Please enter the quantity for each product:\")\n", "for product in products:\n", - " quantity = int(input(\"Quantity of {product}: \"))\n", + " quantity = int(input(f\"Quantity of {product}: \"))\n", " inventory[product] = quantity" ] }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 8, "id": "651d46f7-9b9f-4575-9e99-7b120cd002f4", "metadata": {}, "outputs": [], @@ -103,7 +103,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 9, "id": "31ec7061-11cf-4919-a8c2-ff9890dcfaf6", "metadata": {}, "outputs": [ @@ -118,9 +118,9 @@ "name": "stdin", "output_type": "stream", "text": [ - "Product 1: t-shirt\n", - "Product 2: mug\n", - "Product 3: hat\n" + "Product 1: hat\n", + "Product 2: book\n", + "Product 3: mug\n" ] } ], @@ -128,8 +128,6 @@ "print(\"Please enter three products the customer wants to order:\")\n", "for i in range(3):\n", " order = input(f\"Product {i+1}: \").strip().lower()\n", - " \n", - " # Check if product exists\n", " while order not in products:\n", " print(\"Invalid product, please choose from:\", products)\n", " order = input(f\"Product {i+1}: \").strip().lower()\n", @@ -139,7 +137,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 10, "id": "6542cad8-c1f9-4169-8ea8-2fb1fe7afa1f", "metadata": {}, "outputs": [ @@ -147,7 +145,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "{'hat', 't-shirt', 'mug'}\n" + "{'hat', 'book', 'mug'}\n" ] } ], @@ -157,7 +155,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 11, "id": "f98e9f8b-9b19-4a7c-97c3-7e49bfdc1add", "metadata": {}, "outputs": [], @@ -167,7 +165,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 12, "id": "dd653a4c-284c-4e20-ab43-d31e916ed9cd", "metadata": {}, "outputs": [], @@ -177,7 +175,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 13, "id": "823ce3cb-96f4-455d-bb0c-0289d206e5d5", "metadata": {}, "outputs": [], @@ -187,7 +185,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 14, "id": "45d28cf3-2b4a-42b0-8667-c26bf90b9f4b", "metadata": {}, "outputs": [ @@ -207,7 +205,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 15, "id": "46441365-7771-4fe4-95f8-87eaaddaee3c", "metadata": {}, "outputs": [], @@ -218,7 +216,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 16, "id": "820bff22-e3a0-42c6-a0f2-15e0e8651ae7", "metadata": {}, "outputs": [ @@ -226,11 +224,11 @@ "name": "stdout", "output_type": "stream", "text": [ - "t-shirt: 4\n", - "mug: 1\n", - "hat: 7\n", + "t-shirt: 5\n", + "mug: 5\n", + "hat: 6\n", "book: 7\n", - "keychain: 3\n" + "keychain: 9\n" ] } ], @@ -238,6 +236,14 @@ "for product, quantity in inventory.items():\n", " print(f\"{product}: {quantity}\")" ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d6f9c5ac-a460-4b56-9aa3-efaba468aa69", + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { diff --git a/lab-python-data-structures.ipynb b/lab-python-data-structures.ipynb index 5b3ce9e0..1fdb40d2 100644 --- a/lab-python-data-structures.ipynb +++ b/lab-python-data-structures.ipynb @@ -54,9 +54,9 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "Python [conda env:base] *", "language": "python", - "name": "python3" + "name": "conda-base-py" }, "language_info": { "codemirror_mode": { @@ -68,7 +68,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.13.5" } }, "nbformat": 4, From b8e36abb563db4b25dd5fbad4101e189be862a5c Mon Sep 17 00:00:00 2001 From: Ou Hai Date: Thu, 20 Nov 2025 09:21:08 +0100 Subject: [PATCH 3/3] Sloved second time --- .../lab-data-structures-checkpoint.ipynb | 42 +++++++++++-------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/.ipynb_checkpoints/lab-data-structures-checkpoint.ipynb b/.ipynb_checkpoints/lab-data-structures-checkpoint.ipynb index f4bc9497..169ffa73 100644 --- a/.ipynb_checkpoints/lab-data-structures-checkpoint.ipynb +++ b/.ipynb_checkpoints/lab-data-structures-checkpoint.ipynb @@ -93,7 +93,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 8, "id": "651d46f7-9b9f-4575-9e99-7b120cd002f4", "metadata": {}, "outputs": [], @@ -103,7 +103,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 9, "id": "31ec7061-11cf-4919-a8c2-ff9890dcfaf6", "metadata": {}, "outputs": [ @@ -118,9 +118,9 @@ "name": "stdin", "output_type": "stream", "text": [ - "Product 1: t-shirt\n", - "Product 2: mug\n", - "Product 3: hat\n" + "Product 1: hat\n", + "Product 2: book\n", + "Product 3: mug\n" ] } ], @@ -137,7 +137,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 10, "id": "6542cad8-c1f9-4169-8ea8-2fb1fe7afa1f", "metadata": {}, "outputs": [ @@ -145,7 +145,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "{'hat', 't-shirt', 'mug'}\n" + "{'hat', 'book', 'mug'}\n" ] } ], @@ -155,7 +155,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 11, "id": "f98e9f8b-9b19-4a7c-97c3-7e49bfdc1add", "metadata": {}, "outputs": [], @@ -165,7 +165,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 12, "id": "dd653a4c-284c-4e20-ab43-d31e916ed9cd", "metadata": {}, "outputs": [], @@ -175,7 +175,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 13, "id": "823ce3cb-96f4-455d-bb0c-0289d206e5d5", "metadata": {}, "outputs": [], @@ -185,7 +185,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 14, "id": "45d28cf3-2b4a-42b0-8667-c26bf90b9f4b", "metadata": {}, "outputs": [ @@ -205,7 +205,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 15, "id": "46441365-7771-4fe4-95f8-87eaaddaee3c", "metadata": {}, "outputs": [], @@ -216,7 +216,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 16, "id": "820bff22-e3a0-42c6-a0f2-15e0e8651ae7", "metadata": {}, "outputs": [ @@ -224,11 +224,11 @@ "name": "stdout", "output_type": "stream", "text": [ - "t-shirt: 4\n", - "mug: 1\n", - "hat: 7\n", + "t-shirt: 5\n", + "mug: 5\n", + "hat: 6\n", "book: 7\n", - "keychain: 3\n" + "keychain: 9\n" ] } ], @@ -236,6 +236,14 @@ "for product, quantity in inventory.items():\n", " print(f\"{product}: {quantity}\")" ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d6f9c5ac-a460-4b56-9aa3-efaba468aa69", + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": {