From a5c60d16cba07727ffc51b2fb6f8bae8439d6ed2 Mon Sep 17 00:00:00 2001 From: manufranso Date: Mon, 12 Jan 2026 15:20:58 +0100 Subject: [PATCH 1/7] Update lab-python-data-structures.ipynb --- lab-python-data-structures.ipynb | 95 +++++++++++++++++++++++++++++++- 1 file changed, 93 insertions(+), 2 deletions(-) diff --git a/lab-python-data-structures.ipynb b/lab-python-data-structures.ipynb index 5b3ce9e0..43c8eeca 100644 --- a/lab-python-data-structures.ipynb +++ b/lab-python-data-structures.ipynb @@ -50,11 +50,102 @@ "\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": null, + "metadata": {}, + "outputs": [], + "source": [ + "#1\n", + "\n", + "products = [\"t-shirt\",\"mug\",\"hat\",\"book\",\"keychain\"]" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [], + "source": [ + "#2\n", + "\n", + "inventory = {}" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'t-shirt': 3, 'hat': 2, 'book': 6}" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "#3\n", + "\n", + "input1 \n", + "\n", + "inventory [\"t-shirt\"] = ask1\n", + "inventory [\"hat\"] = ask2\n", + "inventory [\"book\"] = ask3\n", + "\n", + "inventory\n" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'book', 'hat', 't-shirt'}" + ] + }, + "execution_count": 19, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "#4\n", + "\n", + "customer_orders = set()\n", + "\n", + "ask4 = input(\"Dime que producto quieres: \")\n", + "ask5 = input(\"Dime que producto quieres: \")\n", + "ask6 = input(\"Dime que producto quieres: \")\n", + "\n", + "customer_orders.add(ask4)\n", + "customer_orders.add(ask5)\n", + "customer_orders.add(ask6)\n", + "\n", + "customer_orders" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "#5" + ] } ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "base", "language": "python", "name": "python3" }, @@ -68,7 +159,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.13.5" } }, "nbformat": 4, From f56106698a970528240b88ea1a6d943e392b686c Mon Sep 17 00:00:00 2001 From: manufranso Date: Mon, 12 Jan 2026 15:23:45 +0100 Subject: [PATCH 2/7] Update lab-python-data-structures.ipynb --- lab-python-data-structures.ipynb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lab-python-data-structures.ipynb b/lab-python-data-structures.ipynb index 43c8eeca..951eb185 100644 --- a/lab-python-data-structures.ipynb +++ b/lab-python-data-structures.ipynb @@ -57,9 +57,7 @@ "metadata": {}, "outputs": [], "source": [ - "#1\n", - "\n", - "products = [\"t-shirt\",\"mug\",\"hat\",\"book\",\"keychain\"]" + "productos = [\"t-shirt\",\"mug\",\"hat\",\"book\"]" ] }, { From 7acee40d534d9ece96f36dc096c113f6880693d6 Mon Sep 17 00:00:00 2001 From: manufranso Date: Mon, 12 Jan 2026 15:25:02 +0100 Subject: [PATCH 3/7] Update lab-python-data-structures.ipynb --- lab-python-data-structures.ipynb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lab-python-data-structures.ipynb b/lab-python-data-structures.ipynb index 951eb185..feb21894 100644 --- a/lab-python-data-structures.ipynb +++ b/lab-python-data-structures.ipynb @@ -90,11 +90,8 @@ "source": [ "#3\n", "\n", - "input1 \n", + "input1 = input(\"Enter a product name: \")\n", "\n", - "inventory [\"t-shirt\"] = ask1\n", - "inventory [\"hat\"] = ask2\n", - "inventory [\"book\"] = ask3\n", "\n", "inventory\n" ] From f2829f49598fa9b368ac00167997723868c781a9 Mon Sep 17 00:00:00 2001 From: manufranso Date: Mon, 12 Jan 2026 15:30:22 +0100 Subject: [PATCH 4/7] update exercises --- 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 feb21894..66247a63 100644 --- a/lab-python-data-structures.ipynb +++ b/lab-python-data-structures.ipynb @@ -62,12 +62,12 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#2\n", - "\n", + "fgs\n", "inventory = {}" ] }, From fa3fc9a48868da229f3f21731416c69a83e1ccc8 Mon Sep 17 00:00:00 2001 From: manufranso Date: Mon, 12 Jan 2026 15:35:30 +0100 Subject: [PATCH 5/7] Update lab-python-data-structures.ipynb --- lab-python-data-structures.ipynb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lab-python-data-structures.ipynb b/lab-python-data-structures.ipynb index 66247a63..7a35be48 100644 --- a/lab-python-data-structures.ipynb +++ b/lab-python-data-structures.ipynb @@ -57,7 +57,9 @@ "metadata": {}, "outputs": [], "source": [ - "productos = [\"t-shirt\",\"mug\",\"hat\",\"book\"]" + "#1\n", + "\n", + "products = [\"t-shirt\", \"mug\", \"hat\", \"book\", \"keychain\"]" ] }, { @@ -67,7 +69,7 @@ "outputs": [], "source": [ "#2\n", - "fgs\n", + "\n", "inventory = {}" ] }, @@ -90,8 +92,9 @@ "source": [ "#3\n", "\n", - "input1 = input(\"Enter a product name: \")\n", - "\n", + "input1 = int(input(f\"Enter a quantity : {products} \"))\n", + "input2 = int(input(f\"Enter a quantity : {products}\"))\n", + "input3 = int(input(f\"Enter a quantity : {products}\"))\n", "\n", "inventory\n" ] From 3ca31aa949eb5ac52fbf36bb863e3b95c7fa7a42 Mon Sep 17 00:00:00 2001 From: manufranso Date: Mon, 12 Jan 2026 16:37:11 +0100 Subject: [PATCH 6/7] Update lab-python-data-structures.ipynb Ejercicios data-structures --- lab-python-data-structures.ipynb | 144 ++++++++++++++++++++++++++----- 1 file changed, 121 insertions(+), 23 deletions(-) diff --git a/lab-python-data-structures.ipynb b/lab-python-data-structures.ipynb index 7a35be48..f59a72a2 100644 --- a/lab-python-data-structures.ipynb +++ b/lab-python-data-structures.ipynb @@ -53,7 +53,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 87, "metadata": {}, "outputs": [], "source": [ @@ -64,7 +64,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 88, "metadata": {}, "outputs": [], "source": [ @@ -75,16 +75,16 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 89, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "{'t-shirt': 3, 'hat': 2, 'book': 6}" + "{'t-shirt': 4, 'mug': 3, 'hat': 2}" ] }, - "execution_count": 12, + "execution_count": 89, "metadata": {}, "output_type": "execute_result" } @@ -92,52 +92,150 @@ "source": [ "#3\n", "\n", - "input1 = int(input(f\"Enter a quantity : {products} \"))\n", - "input2 = int(input(f\"Enter a quantity : {products}\"))\n", - "input3 = int(input(f\"Enter a quantity : {products}\"))\n", + "input1 = int(input(f\"Enter a quantity of t-shirt: {products} \"))\n", + "input2 = int(input(f\"Enter a quantity of mug: {products}\"))\n", + "input3 = int(input(f\"Enter a quantity of hats: {products}\"))\n", + "\n", + "inventory[\"t-shirt\"] = input1\n", + "inventory[\"mug\"] = input2\n", + "inventory[\"hat\"] = input3\n", + "\n", "\n", "inventory\n" ] }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 70, + "metadata": {}, + "outputs": [], + "source": [ + "#4\n", + "\n", + "customer_orders = set()" + ] + }, + { + "cell_type": "code", + "execution_count": 79, + "metadata": {}, + "outputs": [], + "source": [ + "#5\n", + "\n", + "input4 = input(f\"Dime que producto quieres: {products}\")\n", + "input5 = input(f\"Dime que producto quieres: {products}\")\n", + "input6 = input(f\"Dime que producto quieres: {products}\")\n", + "\n", + "customer_orders.add(input4)\n", + "customer_orders.add(input5)\n", + "customer_orders.add(input6)\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 80, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'mug', 'hat', 't-shirt', 'book'}\n" + ] + } + ], + "source": [ + "#6\n", + "\n", + "print(customer_orders)" + ] + }, + { + "cell_type": "code", + "execution_count": 73, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "{'book', 'hat', 't-shirt'}" + "60.0" ] }, - "execution_count": 19, + "execution_count": 73, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "#4\n", - "\n", - "customer_orders = set()\n", + "#7\n", "\n", - "ask4 = input(\"Dime que producto quieres: \")\n", - "ask5 = input(\"Dime que producto quieres: \")\n", - "ask6 = input(\"Dime que producto quieres: \")\n", + "total_products_ordered= len(customer_orders)\n", + "total_products_ordered\n", "\n", - "customer_orders.add(ask4)\n", - "customer_orders.add(ask5)\n", - "customer_orders.add(ask6)\n", + "percentage_ordered = (total_products_ordered / len(products)) * 100\n", + "percentage_ordered\n" + ] + }, + { + "cell_type": "code", + "execution_count": 74, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Order Statistics:\n", + "Total Products Ordered: 3 \n", + "Percentage of Products Ordered: 60.0 %\n" + ] + } + ], + "source": [ + "#8 \n", "\n", - "customer_orders" + "print(\"Order Statistics:\" \\\n", + "\"\\nTotal Products Ordered:\", total_products_ordered, \\\n", + "\"\\nPercentage of Products Ordered:\", percentage_ordered, \"%\")\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 92, "metadata": {}, "outputs": [], "source": [ - "#5" + "#9\n", + "inventory\n", + "\n", + "inventory[products[0]] = inventory[products[0]] - 1\n", + "inventory[products[1]] = inventory[products[1]] - 1\n", + "inventory[products[2]] = inventory[products[2]] - 1\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 94, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'t-shirt': 2, 'mug': 1, 'hat': 0}" + ] + }, + "execution_count": 94, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "#10\n", + "\n", + "inventory" ] } ], From b14bd80702a1a5fc4722bdf93587e0459b88247b Mon Sep 17 00:00:00 2001 From: manufranso Date: Mon, 12 Jan 2026 16:39:11 +0100 Subject: [PATCH 7/7] Ejercicios data-structures --- 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 f59a72a2..b18c01a4 100644 --- a/lab-python-data-structures.ipynb +++ b/lab-python-data-structures.ipynb @@ -218,7 +218,7 @@ }, { "cell_type": "code", - "execution_count": 94, + "execution_count": 95, "metadata": {}, "outputs": [ { @@ -227,7 +227,7 @@ "{'t-shirt': 2, 'mug': 1, 'hat': 0}" ] }, - "execution_count": 94, + "execution_count": 95, "metadata": {}, "output_type": "execute_result" }