From 54badbeb43f582e3347457c2e7ccaad3f50042af Mon Sep 17 00:00:00 2001 From: mssamaniegocarriel-ctrl Date: Mon, 13 Apr 2026 14:40:34 +0200 Subject: [PATCH 1/5] Create Untitled-1.py --- Untitled-1.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 Untitled-1.py diff --git a/Untitled-1.py b/Untitled-1.py new file mode 100644 index 00000000..968d3248 --- /dev/null +++ b/Untitled-1.py @@ -0,0 +1 @@ +c:/Users/MEL/.local/bin/python3.10.exe -m pip install ipykernel -U --user From 8719a33c15d90c447ea2736f756141fd5bf7092c Mon Sep 17 00:00:00 2001 From: mssamaniegocarriel-ctrl Date: Mon, 13 Apr 2026 16:31:05 +0200 Subject: [PATCH 2/5] Update lab-python-data-structures.ipynb --- lab-python-data-structures.ipynb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/lab-python-data-structures.ipynb b/lab-python-data-structures.ipynb index 5b3ce9e0..cb001e2a 100644 --- a/lab-python-data-structures.ipynb +++ b/lab-python-data-structures.ipynb @@ -50,6 +50,30 @@ "\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": { + "vscode": { + "languageId": "plaintext" + } + }, + "outputs": [], + "source": [ + "# Step 1: Define the products list\n", + "products = [\"t-shirt\", \"mug\", \"hat\", \"book\", \"keychain\"]\n", + "# Step 2: Create an empty inventory dictionary\n", + "inventory = {}\n", + "# Step 3: Ask the user for the quantity of each product\n", + "for product in products:\n", + "quantity = int(input(f\"Enter the quantity available for {product}: \"))\n", + "# Step 4: Create an empty set for customer orders\n", + "customer_orders = set()\n", + "# Step 5: Ask the user for the products they want to order\n", + " for i in range(3): # Assuming the user can order up to 3 products\n", + "\n" + ] } ], "metadata": { From 66b80e4cc4ad8e573adcb8aa06e2ccfe6ad1f722 Mon Sep 17 00:00:00 2001 From: mssamaniegocarriel-ctrl Date: Mon, 13 Apr 2026 17:36:37 +0200 Subject: [PATCH 3/5] Solved lab --- .vscode/settings.json | 9 ++++++ Untitled-1.py | 53 +++++++++++++++++++++++++++++++- Untitled-2.py | 52 +++++++++++++++++++++++++++++++ lab-python-data-structures.ipynb | 46 +++++++++++++++++++++------ 4 files changed, 149 insertions(+), 11 deletions(-) create mode 100644 .vscode/settings.json create mode 100644 Untitled-2.py diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..4988ec07 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,9 @@ +{ + "python-envs.pythonProjects": [ + { + "path": ".", + "envManager": "ms-python.python:system", + "packageManager": "ms-python.python:pip" + } + ] +} \ No newline at end of file diff --git a/Untitled-1.py b/Untitled-1.py index 968d3248..cb4b705a 100644 --- a/Untitled-1.py +++ b/Untitled-1.py @@ -1 +1,52 @@ -c:/Users/MEL/.local/bin/python3.10.exe -m pip install ipykernel -U --user +"c:\Users\MEL\Downloads\DATA\laboratorio1\Untitled-1.py" + +# Step 1: Define the products list +from doctest import master + +products = ["t-shirt", "mug", "hat", "book", "keychain"] + +# Step 2: Create an empty inventory dictionary +inventory = {} + +# Step 3: Ask the user for the quantity of each product +for product in products: + quantity = int(input(f"Enter the quantity of {product}: ")) + inventory[product] = quantity + +# Step 4: Create an empty set for customer orders +customer_orders = set() + +# Step 5: Ask the user for the products they want to order +for i in range(3): # Assuming the user can order up to 3 products + order = input(f"Enter product {i+1} to order: ") + customer_orders.add(order) + +# Step 6: Print the customer orders +print("\nCustomer Orders:", customer_orders) + +# Step 7: Calculate order statistics +total_products_ordered = len(customer_orders) +percentage_ordered = (total_products_ordered / len(products)) * 100 + +# Store in a tuple +order_status = (total_products_ordered, percentage_ordered) + +# Step 8: Print the order statistics +print("\nOrder Statistics:") +print(f"Total Products Ordered: {order_status[0]}") +print(f"Percentage of Products Ordered: {order_status[1]}%") + +# Step 9: Update inventory by subtracting 1 from each product +for product in inventory: + inventory[product] -= 1 + +# Step 10: Print the updated inventory +print("\nUpdated Inventory:") +for product, quantity in inventory.items(): + print(f"{product}: {quantity}") + +git add . + +git commit -m "Solved lab" + +git push origin master diff --git a/Untitled-2.py b/Untitled-2.py new file mode 100644 index 00000000..cb4b705a --- /dev/null +++ b/Untitled-2.py @@ -0,0 +1,52 @@ +"c:\Users\MEL\Downloads\DATA\laboratorio1\Untitled-1.py" + +# Step 1: Define the products list +from doctest import master + +products = ["t-shirt", "mug", "hat", "book", "keychain"] + +# Step 2: Create an empty inventory dictionary +inventory = {} + +# Step 3: Ask the user for the quantity of each product +for product in products: + quantity = int(input(f"Enter the quantity of {product}: ")) + inventory[product] = quantity + +# Step 4: Create an empty set for customer orders +customer_orders = set() + +# Step 5: Ask the user for the products they want to order +for i in range(3): # Assuming the user can order up to 3 products + order = input(f"Enter product {i+1} to order: ") + customer_orders.add(order) + +# Step 6: Print the customer orders +print("\nCustomer Orders:", customer_orders) + +# Step 7: Calculate order statistics +total_products_ordered = len(customer_orders) +percentage_ordered = (total_products_ordered / len(products)) * 100 + +# Store in a tuple +order_status = (total_products_ordered, percentage_ordered) + +# Step 8: Print the order statistics +print("\nOrder Statistics:") +print(f"Total Products Ordered: {order_status[0]}") +print(f"Percentage of Products Ordered: {order_status[1]}%") + +# Step 9: Update inventory by subtracting 1 from each product +for product in inventory: + inventory[product] -= 1 + +# Step 10: Print the updated inventory +print("\nUpdated Inventory:") +for product, quantity in inventory.items(): + print(f"{product}: {quantity}") + +git add . + +git commit -m "Solved lab" + +git push origin master diff --git a/lab-python-data-structures.ipynb b/lab-python-data-structures.ipynb index cb001e2a..c698d8b7 100644 --- a/lab-python-data-structures.ipynb +++ b/lab-python-data-structures.ipynb @@ -54,31 +54,57 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "vscode": { - "languageId": "plaintext" - } - }, + "metadata": {}, "outputs": [], "source": [ "# Step 1: Define the products list\n", "products = [\"t-shirt\", \"mug\", \"hat\", \"book\", \"keychain\"]\n", + "\n", "# Step 2: Create an empty inventory dictionary\n", "inventory = {}\n", + "\n", "# Step 3: Ask the user for the quantity of each product\n", "for product in products:\n", - "quantity = int(input(f\"Enter the quantity available for {product}: \"))\n", + " quantity = int(input(f\"Enter the quantity of {product}: \"))\n", + " inventory[product] = quantity\n", + "\n", "# Step 4: Create an empty set for customer orders\n", "customer_orders = set()\n", + "\n", "# Step 5: Ask the user for the products they want to order\n", - " for i in range(3): # Assuming the user can order up to 3 products\n", - "\n" + "for i in range(3):\n", + " order = input(f\"Enter product {i+1} to order: \")\n", + " customer_orders.add(order)\n", + "\n", + "# Step 6: Print the customer orders\n", + "print(\"\\nCustomer Orders:\", customer_orders)\n", + "\n", + "# Step 7: Calculate order statistics\n", + "total_products_ordered = len(customer_orders)\n", + "percentage_ordered = (total_products_ordered / len(products)) * 100\n", + "\n", + "# Store in a tuple\n", + "order_status = (total_products_ordered, percentage_ordered)\n", + "\n", + "# Step 8: Print the order statistics\n", + "print(\"\\nOrder Statistics:\")\n", + "print(f\"Total Products Ordered: {order_status[0]}\")\n", + "print(f\"Percentage of Products Ordered: {order_status[1]}%\")\n", + "\n", + "# Step 9: Update inventory by subtracting 1 from each product\n", + "for product in inventory:\n", + " inventory[product] -= 1\n", + "\n", + "# Step 10: Print the updated inventory\n", + "print(\"\\nUpdated Inventory:\")\n", + "for product, quantity in inventory.items():\n", + " print(f\"{product}: {quantity}\")" ] } ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "Python 3", "language": "python", "name": "python3" }, @@ -92,7 +118,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.10.20" } }, "nbformat": 4, From b9ee9312ff3571a0952ce234fe92190ec5d759c6 Mon Sep 17 00:00:00 2001 From: mssamaniegocarriel-ctrl Date: Mon, 13 Apr 2026 17:52:30 +0200 Subject: [PATCH 4/5] Create lab-python-data-structureslab1.ipynb --- lab-python-data-structureslab1.ipynb | 133 +++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 lab-python-data-structureslab1.ipynb diff --git a/lab-python-data-structureslab1.ipynb b/lab-python-data-structureslab1.ipynb new file mode 100644 index 00000000..c84db169 --- /dev/null +++ b/lab-python-data-structureslab1.ipynb @@ -0,0 +1,133 @@ +{ + "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. " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Step 1: Define the products list\n", + "products = [\"t-shirt\", \"mug\", \"hat\", \"book\", \"keychain\"]\n", + "\n", + "# Step 2: Create an empty inventory dictionary\n", + "inventory = {}\n", + "\n", + "# Step 3: Ask the user for the quantity of each product\n", + "for product in products:\n", + " quantity = int(input(f\"Enter the quantity of {product}: \"))\n", + " inventory[product] = quantity\n", + "\n", + "# Step 4: Create an empty set for customer orders\n", + "customer_orders = set()\n", + "\n", + "# Step 5: Ask the user for the products they want to order\n", + "for i in range(3):\n", + " order = input(f\"Enter product {i+1} to order: \")\n", + " customer_orders.add(order)\n", + "\n", + "# Step 6: Print the customer orders\n", + "print(\"\\nCustomer Orders:\", customer_orders)\n", + "\n", + "# Step 7: Calculate order statistics\n", + "total_products_ordered = len(customer_orders)\n", + "percentage_ordered = (total_products_ordered / len(products)) * 100\n", + "\n", + "# Store in a tuple\n", + "order_status = (total_products_ordered, percentage_ordered)\n", + "\n", + "# Step 8: Print the order statistics\n", + "print(\"\\nOrder Statistics:\")\n", + "print(f\"Total Products Ordered: {order_status[0]}\")\n", + "print(f\"Percentage of Products Ordered: {order_status[1]}%\")\n", + "\n", + "# Step 9: Update inventory by subtracting 1 from each product\n", + "for product in inventory:\n", + " inventory[product] -= 1\n", + "\n", + "# Step 10: Print the updated inventory\n", + "print(\"\\nUpdated Inventory:\")\n", + "for product, quantity in inventory.items():\n", + " print(f\"{product}: {quantity}\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "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.10.20" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} From 331a6de7e4f0c717b0755a0a200d8b292e35ecc4 Mon Sep 17 00:00:00 2001 From: mssamaniegocarriel-ctrl Date: Mon, 13 Apr 2026 17:52:33 +0200 Subject: [PATCH 5/5] Update lab-python-data-structures.ipynb --- lab-python-data-structures.ipynb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lab-python-data-structures.ipynb b/lab-python-data-structures.ipynb index c698d8b7..c84db169 100644 --- a/lab-python-data-structures.ipynb +++ b/lab-python-data-structures.ipynb @@ -100,6 +100,13 @@ "for product, quantity in inventory.items():\n", " print(f\"{product}: {quantity}\")" ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": {