From 9091e789bc38186cabc06835eeefaa965f728274 Mon Sep 17 00:00:00 2001 From: eliomartinezcastano-stack Date: Mon, 12 Jan 2026 15:32:39 +0100 Subject: [PATCH 1/4] results From bab707721007d8ffc4407635492211c1d4e56eed Mon Sep 17 00:00:00 2001 From: eliomartinezcastano-stack Date: Mon, 12 Jan 2026 15:50:43 +0100 Subject: [PATCH 2/4] actualizacion From e051b1d427bd7d9da84da52d38b90ed5c031bcf5 Mon Sep 17 00:00:00 2001 From: eliomartinezcastano-stack Date: Mon, 12 Jan 2026 16:09:43 +0100 Subject: [PATCH 3/4] actualizacion --- lab-python-data-structures.ipynb | 102 ++++++++++++++++++++++++++++++- 1 file changed, 100 insertions(+), 2 deletions(-) diff --git a/lab-python-data-structures.ipynb b/lab-python-data-structures.ipynb index 5b3ce9e0..c49eca10 100644 --- a/lab-python-data-structures.ipynb +++ b/lab-python-data-structures.ipynb @@ -50,11 +50,109 @@ "\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": [], + "source": [ + "products =[\"t-shirt\", \"mug\", \"hat\", \"book\", \"keychain\"]" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "inventory = {}" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "inventory[\"t-shirt\"] = int(input(\"Enter the quantity of t-shirt: \"))\n", + "inventory[\"mug\"] = int(input(\"Enter the quantity of mug: \"))\n", + "inventory[\"hat\"] = int(input(\"Enter the quantity of hat: \"))\n", + "inventory[\"book\"] = int(input(\"Enter the quantity of book: \"))\n", + "inventory[\"keychain\"] = int(input(\"Enter the quantity of keychain: \"))" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "customer_orders = set()" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "product1 = input(\"Enter the first product: \")\n", + "customer_orders.add(product1)\n", + "product2 = input(\"Enter the second product: \")\n", + "customer_orders.add(product2)\n", + "product3 = input(\"Enter the third product: \")\n", + "customer_orders.add(product3)" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'hat', 'mug', 'book'}\n" + ] + } + ], + "source": [ + "print (customer_orders)" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "3" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "len (customer_orders)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "base", "language": "python", "name": "python3" }, @@ -68,7 +166,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.13.9" } }, "nbformat": 4, From d79129d3e688755c6d087f92ca61d16ee7284b6e Mon Sep 17 00:00:00 2001 From: eliomartinezcastano-stack Date: Mon, 12 Jan 2026 16:49:34 +0100 Subject: [PATCH 4/4] final --- lab-python-data-structures.ipynb | 80 +++++++++++++++++++++++++++----- 1 file changed, 68 insertions(+), 12 deletions(-) diff --git a/lab-python-data-structures.ipynb b/lab-python-data-structures.ipynb index c49eca10..cf930ff3 100644 --- a/lab-python-data-structures.ipynb +++ b/lab-python-data-structures.ipynb @@ -124,30 +124,86 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 8, + "metadata": {}, + "outputs": [], + "source": [ + "products_ordered = len (customer_orders)" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [], + "source": [ + "percentage_ordered = (products_ordered / len (products) * 100)" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [], + "source": [ + "order_status = (products_ordered, percentage_ordered)" + ] + }, + { + "cell_type": "code", + "execution_count": 13, "metadata": {}, "outputs": [ { - "data": { - "text/plain": [ - "3" - ] - }, - "execution_count": 7, - "metadata": {}, - "output_type": "execute_result" + "name": "stdout", + "output_type": "stream", + "text": [ + "Order statistics: \n", + "total products ordered: 3\n", + "Percentage of products ordered: 60.0\n" + ] } ], "source": [ - "len (customer_orders)" + "print (\"Order statistics: \")\n", + "print (f\"total products ordered: {products_ordered}\")\n", + "print (f\"Percentage of products ordered: {percentage_ordered}\")" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 14, "metadata": {}, "outputs": [], - "source": [] + "source": [ + "for product in inventory:\n", + " inventory[product] -= 1" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "t-shirt: 2\n", + "mug: 3\n", + "hat: 4\n", + "book: 5\n", + "keychain: 6\n" + ] + } + ], + "source": [ + "print (f\"t-shirt: {inventory[\"t-shirt\"]}\")\n", + "print (f\"mug: {inventory[\"mug\"]}\")\n", + "print (f\"hat: {inventory[\"hat\"]}\") \n", + "print (f\"book: {inventory[\"book\"]}\") \n", + "print (f\"keychain: {inventory[\"keychain\"]}\")" + ] } ], "metadata": {