From 8d6bcbc656cb3f4533ef827a8a421dbdfd639a17 Mon Sep 17 00:00:00 2001 From: carmamenriosrodriguez Date: Mon, 12 Jan 2026 15:52:53 +0100 Subject: [PATCH 1/6] cambios --- lab-python-data-structures.ipynb | 46 ++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/lab-python-data-structures.ipynb b/lab-python-data-structures.ipynb index 5b3ce9e0..28314e7c 100644 --- a/lab-python-data-structures.ipynb +++ b/lab-python-data-structures.ipynb @@ -50,11 +50,53 @@ "\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": 21, + "metadata": {}, + "outputs": [], + "source": [ + "products = [\"t-shirt\", \"mug\", \"hat\", \"book\", \"keychain\"]\n", + "inventory = {}\n", + "inventory[\"t-shirts\"] = int(input(\"Write a quantity of t-shirts\"))\n", + "inventory[\"mugs\"] = int(input(\"Write a quantity of mugs\"))\n", + "inventory[\"hats\"] = int(input(\"Write a quantity of hats\"))\n", + "inventory[\"books\"] = int(input(\"Write a quantity of books\"))\n", + "inventory[\"keychains\"] = int(input(\"Write a quantity of keychains\"))\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "set()\n" + ] + } + ], + "source": [ + "costumer_orders = set()\n", + "custumer_orders.add(input(\"Write a product to order\"))\n", + "custumer_orders.add(input(\"Write a product to order\"))\n", + "custumer_orders.add(input(\"Write a product to order\"))\n" + ] } ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "ds", "language": "python", "name": "python3" }, @@ -68,7 +110,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.12.12" } }, "nbformat": 4, From fe0f5b5bb3f4c5cffca9d8a5dea62b528da8f3ad Mon Sep 17 00:00:00 2001 From: carmamenriosrodriguez Date: Mon, 12 Jan 2026 16:34:10 +0100 Subject: [PATCH 2/6] Update lab-python-data-structures.ipynb --- lab-python-data-structures.ipynb | 131 ++++++++++++++++++++++++++++--- 1 file changed, 121 insertions(+), 10 deletions(-) diff --git a/lab-python-data-structures.ipynb b/lab-python-data-structures.ipynb index 28314e7c..247c3ee7 100644 --- a/lab-python-data-structures.ipynb +++ b/lab-python-data-structures.ipynb @@ -9,6 +9,13 @@ "# Lab | Data Structures " ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, { "cell_type": "markdown", "metadata": {}, @@ -53,9 +60,17 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 31, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'t-shirts': 45, 'mugs': 3, 'hats': 2, 'books': 44, 'keychains': 3}\n" + ] + } + ], "source": [ "products = [\"t-shirt\", \"mug\", \"hat\", \"book\", \"keychain\"]\n", "inventory = {}\n", @@ -64,33 +79,129 @@ "inventory[\"hats\"] = int(input(\"Write a quantity of hats\"))\n", "inventory[\"books\"] = int(input(\"Write a quantity of books\"))\n", "inventory[\"keychains\"] = int(input(\"Write a quantity of keychains\"))\n", - "\n", + "print(inventory)\n", "\n" ] }, { - "cell_type": "markdown", + "cell_type": "code", + "execution_count": 28, "metadata": {}, - "source": [] + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'hat', 'book', 'mug'}\n" + ] + } + ], + "source": [ + "costumer_orders = set()\n", + "costumer_orders.add(input(\"Write a product to order\"))\n", + "costumer_orders.add(input(\"Write a product to order\"))\n", + "costumer_orders.add(input(\"Write a product to order\"))\n", + "print(costumer_orders)" + ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "3" + ] + }, + "execution_count": 36, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "len(costumer_orders)" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "set()\n" + "0.6\n" ] } ], "source": [ - "costumer_orders = set()\n", - "custumer_orders.add(input(\"Write a product to order\"))\n", - "custumer_orders.add(input(\"Write a product to order\"))\n", - "custumer_orders.add(input(\"Write a product to order\"))\n" + "total_inventory = len(inventory)\n", + "percentage_ordered = len(costumer_orders) / len(inventory)\n", + "print(percentage_ordered)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Order Statistics:\n", + "Total Products Ordered: 5\n", + "Percentage of Products Ordered: 0.6%\n" + ] + } + ], + "source": [ + "order_status = (total_inventory, percentage_ordered)\n", + "print(\"Order Statistics:\")\n", + "print(f\"Total Products Ordered: {order_status[0]}\")\n", + "print(f\"Percentage of Products Ordered: {order_status[1]}%\")\n" + ] + }, + { + "cell_type": "code", + "execution_count": 43, + "metadata": {}, + "outputs": [], + "source": [ + "inventory[\"t-shirts\"] = inventory[\"t-shirts\"] - 1\n", + "inventory[\"mugs\"] = inventory[\"mugs\"] - 1\n", + "inventory[\"hats\"] = inventory[\"hats\"] - 1\n", + "inventory[\"books\"] = inventory[\"books\"] - 1\n", + "inventory[\"keychains\"] = inventory[\"keychains\"] - 1\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 44, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "t-shirts: 42\n", + "mugs: 0\n", + "hats: -1\n", + "books: 41\n", + "keychains: 0\n" + ] + } + ], + "source": [ + "print(\"t-shirts:\", inventory[\"t-shirts\"])\n", + "print(\"mugs:\", inventory[\"mugs\"])\n", + "print(\"hats:\", inventory[\"hats\"])\n", + "print(\"books:\", inventory[\"books\"])\n", + "print(\"keychains:\", inventory[\"keychains\"])" ] } ], From 850cb2c69ae96b5ba8b64352d7a8c2cd514d87e9 Mon Sep 17 00:00:00 2001 From: carmamenriosrodriguez Date: Mon, 12 Jan 2026 16:37:41 +0100 Subject: [PATCH 3/6] Update lab-python-data-structures.ipynb --- lab-python-data-structures.ipynb | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/lab-python-data-structures.ipynb b/lab-python-data-structures.ipynb index 247c3ee7..3396be59 100644 --- a/lab-python-data-structures.ipynb +++ b/lab-python-data-structures.ipynb @@ -167,21 +167,29 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": 46, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'t-shirts': 41, 'mugs': -1, 'hats': -2, 'books': 40, 'keychains': -1}\n" + ] + } + ], "source": [ "inventory[\"t-shirts\"] = inventory[\"t-shirts\"] - 1\n", "inventory[\"mugs\"] = inventory[\"mugs\"] - 1\n", "inventory[\"hats\"] = inventory[\"hats\"] - 1\n", "inventory[\"books\"] = inventory[\"books\"] - 1\n", "inventory[\"keychains\"] = inventory[\"keychains\"] - 1\n", - "\n" + "print(inventory)\n" ] }, { "cell_type": "code", - "execution_count": 44, + "execution_count": 45, "metadata": {}, "outputs": [ { @@ -203,6 +211,13 @@ "print(\"books:\", inventory[\"books\"])\n", "print(\"keychains:\", inventory[\"keychains\"])" ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { From 0220c41ecbb408e6f1eea4084d181b36d41dc539 Mon Sep 17 00:00:00 2001 From: carmamenriosrodriguez Date: Mon, 12 Jan 2026 16:41:55 +0100 Subject: [PATCH 4/6] Update lab-python-data-structures.ipynb --- lab-python-data-structures.ipynb | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/lab-python-data-structures.ipynb b/lab-python-data-structures.ipynb index 3396be59..e0773d1e 100644 --- a/lab-python-data-structures.ipynb +++ b/lab-python-data-structures.ipynb @@ -167,24 +167,16 @@ }, { "cell_type": "code", - "execution_count": 46, + "execution_count": 47, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{'t-shirts': 41, 'mugs': -1, 'hats': -2, 'books': 40, 'keychains': -1}\n" - ] - } - ], + "outputs": [], "source": [ "inventory[\"t-shirts\"] = inventory[\"t-shirts\"] - 1\n", "inventory[\"mugs\"] = inventory[\"mugs\"] - 1\n", "inventory[\"hats\"] = inventory[\"hats\"] - 1\n", "inventory[\"books\"] = inventory[\"books\"] - 1\n", "inventory[\"keychains\"] = inventory[\"keychains\"] - 1\n", - "print(inventory)\n" + "\n" ] }, { From 31ddfbf4e8d1b8443bc036fe1758fe28fe5d98dd Mon Sep 17 00:00:00 2001 From: carmamenriosrodriguez Date: Mon, 12 Jan 2026 16:45:04 +0100 Subject: [PATCH 5/6] Update lab-python-data-structures.ipynb --- lab-python-data-structures.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lab-python-data-structures.ipynb b/lab-python-data-structures.ipynb index e0773d1e..e5f9effe 100644 --- a/lab-python-data-structures.ipynb +++ b/lab-python-data-structures.ipynb @@ -126,7 +126,7 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -139,7 +139,7 @@ ], "source": [ "total_inventory = len(inventory)\n", - "percentage_ordered = len(costumer_orders) / len(inventory)\n", + "percentage_ordered = len(costumer_orders) / len(inventory) * 100\n", "print(percentage_ordered)\n" ] }, From c97cd2834810d5c8ec2cb8842f7afa2037cc3925 Mon Sep 17 00:00:00 2001 From: carmamenriosrodriguez Date: Mon, 12 Jan 2026 16:55:43 +0100 Subject: [PATCH 6/6] Update lab-python-data-structures.ipynb --- lab-python-data-structures.ipynb | 53 ++++++++++++-------------------- 1 file changed, 19 insertions(+), 34 deletions(-) diff --git a/lab-python-data-structures.ipynb b/lab-python-data-structures.ipynb index e5f9effe..a10e1a39 100644 --- a/lab-python-data-structures.ipynb +++ b/lab-python-data-structures.ipynb @@ -60,25 +60,25 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 48, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "{'t-shirts': 45, 'mugs': 3, 'hats': 2, 'books': 44, 'keychains': 3}\n" + "{'t-shirt': 64, 'mug': 5, 'hat': 44, 'book': 553, 'keychain': 22}\n" ] } ], "source": [ "products = [\"t-shirt\", \"mug\", \"hat\", \"book\", \"keychain\"]\n", "inventory = {}\n", - "inventory[\"t-shirts\"] = int(input(\"Write a quantity of t-shirts\"))\n", - "inventory[\"mugs\"] = int(input(\"Write a quantity of mugs\"))\n", - "inventory[\"hats\"] = int(input(\"Write a quantity of hats\"))\n", - "inventory[\"books\"] = int(input(\"Write a quantity of books\"))\n", - "inventory[\"keychains\"] = int(input(\"Write a quantity of keychains\"))\n", + "inventory[\"t-shirt\"] = int(input(\"Write a quantity of t-shirt\"))\n", + "inventory[\"mug\"] = int(input(\"Write a quantity of mug\"))\n", + "inventory[\"hat\"] = int(input(\"Write a quantity of hat\"))\n", + "inventory[\"book\"] = int(input(\"Write a quantity of book\"))\n", + "inventory[\"keychain\"] = int(input(\"Write a quantity of keychain\"))\n", "print(inventory)\n", "\n" ] @@ -126,26 +126,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 51, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0.6\n" - ] - } - ], + "outputs": [], "source": [ - "total_inventory = len(inventory)\n", - "percentage_ordered = len(costumer_orders) / len(inventory) * 100\n", - "print(percentage_ordered)\n" + "total_products_ordered = len(customer_orders)\n", + "percentage_ordered = total_products_ordered / len(products) * 100\n", + "order_status = (total_products_ordered, percentage_ordered)" ] }, { "cell_type": "code", - "execution_count": 40, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -167,15 +159,15 @@ }, { "cell_type": "code", - "execution_count": 47, + "execution_count": 52, "metadata": {}, "outputs": [], "source": [ - "inventory[\"t-shirts\"] = inventory[\"t-shirts\"] - 1\n", - "inventory[\"mugs\"] = inventory[\"mugs\"] - 1\n", - "inventory[\"hats\"] = inventory[\"hats\"] - 1\n", - "inventory[\"books\"] = inventory[\"books\"] - 1\n", - "inventory[\"keychains\"] = inventory[\"keychains\"] - 1\n", + "inventory[\"t-shirt\"] = inventory[\"t-shirt\"] - 1\n", + "inventory[\"mug\"] = inventory[\"mug\"] - 1\n", + "inventory[\"hat\"] = inventory[\"hat\"] - 1\n", + "inventory[\"book\"] = inventory[\"book\"] - 1\n", + "inventory[\"keychain\"] = inventory[\"keychain\"] - 1\n", "\n" ] }, @@ -203,13 +195,6 @@ "print(\"books:\", inventory[\"books\"])\n", "print(\"keychains:\", inventory[\"keychains\"])" ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": {