From c6cd6a54537f1405aa1616b3672056e573996972 Mon Sep 17 00:00:00 2001 From: carmenlnr Date: Mon, 13 Apr 2026 15:45:03 +0200 Subject: [PATCH 1/4] Update lab-python-data-structures.ipynb Prueba Lab estructuras hasta punto 2 --- lab-python-data-structures.ipynb | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/lab-python-data-structures.ipynb b/lab-python-data-structures.ipynb index 5b3ce9e0..9faa1e20 100644 --- a/lab-python-data-structures.ipynb +++ b/lab-python-data-structures.ipynb @@ -50,11 +50,34 @@ "\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": 1, + "metadata": {}, + "outputs": [ + { + "ename": "ValueError", + "evalue": "invalid literal for int() with base 10: 't-shirt 3'", + "output_type": "error", + "traceback": [ + "\u001b[31m---------------------------------------------------------------------------\u001b[39m", + "\u001b[31mValueError\u001b[39m Traceback (most recent call last)", + "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[1]\u001b[39m\u001b[32m, line 3\u001b[39m\n\u001b[32m 1\u001b[39m products = [\u001b[33m\"t-shirt\"\u001b[39m, \u001b[33m\"mug\"\u001b[39m, \u001b[33m\"hat\"\u001b[39m, \u001b[33m\"book\"\u001b[39m, \u001b[33m\"keychain\"\u001b[39m]\n\u001b[32m 2\u001b[39m inventory = {}\n\u001b[32m----> \u001b[39m\u001b[32m3\u001b[39m user = int (input(f\"please enter quantity of {products}:\"))\n", + "\u001b[31mValueError\u001b[39m: invalid literal for int() with base 10: 't-shirt 3'" + ] + } + ], + "source": [ + "products = [\"t-shirt\", \"mug\", \"hat\", \"book\", \"keychain\"]\n", + "inventory = {}\n", + "user = int (input(f\"please enter quantity of {products}:\"))\n" + ] } ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "Python 3", "language": "python", "name": "python3" }, @@ -68,7 +91,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.14.3" } }, "nbformat": 4, From 74a70b542db562e7616f5b26cf7c75aaa150816c Mon Sep 17 00:00:00 2001 From: carmenlnr Date: Mon, 13 Apr 2026 17:26:23 +0200 Subject: [PATCH 2/4] Update lab-python-data-structures.ipynb Data lab finished --- lab-python-data-structures.ipynb | 74 +++++++++++++++++++++++++++----- 1 file changed, 64 insertions(+), 10 deletions(-) diff --git a/lab-python-data-structures.ipynb b/lab-python-data-structures.ipynb index 9faa1e20..74a05431 100644 --- a/lab-python-data-structures.ipynb +++ b/lab-python-data-structures.ipynb @@ -53,25 +53,79 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 10, "metadata": {}, "outputs": [ { - "ename": "ValueError", - "evalue": "invalid literal for int() with base 10: 't-shirt 3'", - "output_type": "error", - "traceback": [ - "\u001b[31m---------------------------------------------------------------------------\u001b[39m", - "\u001b[31mValueError\u001b[39m Traceback (most recent call last)", - "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[1]\u001b[39m\u001b[32m, line 3\u001b[39m\n\u001b[32m 1\u001b[39m products = [\u001b[33m\"t-shirt\"\u001b[39m, \u001b[33m\"mug\"\u001b[39m, \u001b[33m\"hat\"\u001b[39m, \u001b[33m\"book\"\u001b[39m, \u001b[33m\"keychain\"\u001b[39m]\n\u001b[32m 2\u001b[39m inventory = {}\n\u001b[32m----> \u001b[39m\u001b[32m3\u001b[39m user = int (input(f\"please enter quantity of {products}:\"))\n", - "\u001b[31mValueError\u001b[39m: invalid literal for int() with base 10: 't-shirt 3'" + "name": "stdout", + "output_type": "stream", + "text": [ + "{'book', 'mug', 'hat'}\n", + "Order Statistics:\n", + "Total products ordered: 3\n", + "Percentage of products ordered: 60.0 %\n", + "\n", + "Updated inventory:\n", + "t-shirt: 1\n", + "mug: 3\n", + "hat: 5\n", + "book: 7\n", + "keychain: 9\n" ] } ], "source": [ + "# 1\n", "products = [\"t-shirt\", \"mug\", \"hat\", \"book\", \"keychain\"]\n", + "# 2\n", "inventory = {}\n", - "user = int (input(f\"please enter quantity of {products}:\"))\n" + "# 3\n", + "inventory[\"t-shirt\"] = int(input(\"Cantidad t-shirt: \"))\n", + "inventory[\"mug\"] = int(input(\"Cantidad mug: \"))\n", + "inventory[\"hat\"] = int(input(\"Cantidad hat: \"))\n", + "inventory[\"book\"] = int(input(\"Cantidad book: \"))\n", + "inventory[\"keychain\"] = int(input(\"Cantidad keychain: \"))\n", + "# 4\n", + "customer_orders = set ()\n", + "# 5\n", + "order1 = input(\"Type product 1: \")\n", + "customer_orders.add(order1)\n", + "\n", + "order2 = input(\"Type product 2: \")\n", + "customer_orders.add(order2)\n", + "\n", + "order3 = input(\"Type product 3: \")\n", + "customer_orders.add(order3)\n", + "\n", + "# 6\n", + "print (customer_orders)\n", + "\n", + "# 7\n", + "total = len (customer_orders)\n", + "percentage = (total / len(products)) * 100\n", + "order_status = (total, percentage)\n", + "\n", + "# 8 \n", + "print(\"Order Statistics:\")\n", + "print(\"Total products ordered:\", total)\n", + "print(\"Percentage of products ordered:\", percentage, \"%\")\n", + "\n", + "# 9 \n", + "inventory[\"t-shirt\"] -= 1\n", + "inventory[\"mug\"] -= 1\n", + "inventory[\"hat\"] -= 1\n", + "inventory[\"book\"] -= 1\n", + "inventory[\"keychain\"] -= 1\n", + "\n", + "# 10\n", + "print()\n", + "print(\"Updated inventory:\")\n", + "\n", + "print(\"t-shirt:\", inventory[\"t-shirt\"])\n", + "print(\"mug:\", inventory[\"mug\"])\n", + "print(\"hat:\", inventory[\"hat\"])\n", + "print(\"book:\", inventory[\"book\"])\n", + "print(\"keychain:\", inventory[\"keychain\"])" ] } ], From 43a2a580d12ea15346f68d71cf577fe85422751f Mon Sep 17 00:00:00 2001 From: carmenlnr Date: Mon, 13 Apr 2026 17:35:27 +0200 Subject: [PATCH 3/4] Update lab-python-data-structures.ipynb Lab 1 finished --- lab-python-data-structures.ipynb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lab-python-data-structures.ipynb b/lab-python-data-structures.ipynb index 74a05431..a122d1f1 100644 --- a/lab-python-data-structures.ipynb +++ b/lab-python-data-structures.ipynb @@ -53,7 +53,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -125,7 +125,8 @@ "print(\"mug:\", inventory[\"mug\"])\n", "print(\"hat:\", inventory[\"hat\"])\n", "print(\"book:\", inventory[\"book\"])\n", - "print(\"keychain:\", inventory[\"keychain\"])" + "print(\"keychain:\", inventory[\"keychain\"])\n", + "\n" ] } ], From 59574238ea1de86fec5ba4ebf3d5b456d03ef8e8 Mon Sep 17 00:00:00 2001 From: carmenlnr Date: Mon, 13 Apr 2026 17:39:06 +0200 Subject: [PATCH 4/4] Update lab-python-data-structures.ipynb Lab 1 finished (from 1 to 10) --- lab-python-data-structures.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lab-python-data-structures.ipynb b/lab-python-data-structures.ipynb index a122d1f1..d082a313 100644 --- a/lab-python-data-structures.ipynb +++ b/lab-python-data-structures.ipynb @@ -119,7 +119,7 @@ "\n", "# 10\n", "print()\n", - "print(\"Updated inventory:\")\n", + "print(\"Updated inventory list:\")\n", "\n", "print(\"t-shirt:\", inventory[\"t-shirt\"])\n", "print(\"mug:\", inventory[\"mug\"])\n",