From c88ccd8fa53d2cc962a53fce4c182779ba3c208e Mon Sep 17 00:00:00 2001 From: Andre Delgado Date: Sat, 19 Sep 2026 11:06:27 +0100 Subject: [PATCH 1/2] Week1Lab1 Done --- lab-python-data-structures.ipynb | 77 +------------------------------- 1 file changed, 1 insertion(+), 76 deletions(-) diff --git a/lab-python-data-structures.ipynb b/lab-python-data-structures.ipynb index 5b3ce9e0..277a4f88 100644 --- a/lab-python-data-structures.ipynb +++ b/lab-python-data-structures.ipynb @@ -1,76 +1 @@ -{ - "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. " - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "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.9.13" - } - }, - "nbformat": 4, - "nbformat_minor": 4 -} +"ew0KICJjZWxscyI6IFsNCiAgew0KICAgImNlbGxfdHlwZSI6ICJtYXJrZG93biIsDQogICAibWV0YWRhdGEiOiB7DQogICAgInRhZ3MiOiBbXQ0KICAgfSwNCiAgICJzb3VyY2UiOiBbDQogICAgIiMgTGFiIHwgRGF0YSBTdHJ1Y3R1cmVzICINCiAgIF0NCiAgfSwNCiAgew0KICAgImNlbGxfdHlwZSI6ICJtYXJrZG93biIsDQogICAibWV0YWRhdGEiOiB7fSwNCiAgICJzb3VyY2UiOiBbDQogICAgIiMjIEV4ZXJjaXNlOiBNYW5hZ2luZyBDdXN0b21lciBPcmRlcnNcbiIsDQogICAgIlxuIiwNCiAgICAiQXMgcGFydCBvZiBhIGJ1c2luZXNzIHZlbnR1cmUsIHlvdSBhcmUgc3RhcnRpbmcgYW4gb25saW5lIHN0b3JlIHRoYXQgc2VsbHMgdmFyaW91cyBwcm9kdWN0cy4gVG8gZW5zdXJlIHNtb290aCBvcGVyYXRpb25zLCB5b3UgbmVlZCB0byBkZXZlbG9wIGEgcHJvZ3JhbSB0aGF0IG1hbmFnZXMgY3VzdG9tZXIgb3JkZXJzIGFuZCBpbnZlbnRvcnkuXG4iLA0KICAgICJcbiIsDQogICAgIkZvbGxvdyB0aGUgc3RlcHMgYmVsb3cgdG8gY29tcGxldGUgdGhlIGV4ZXJjaXNlOlxuIiwNCiAgICAiXG4iLA0KICAgICIxLiBEZWZpb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WAgZGljdGlvbmFyeSBhY2NvcmRpbmdseS5cbiIsDQogICAgIlxuIiwNCiAgICAiMTAuIFByaW50IHRoZSB1cGRhdGVkIGludmVudG9yeSwgZGlzcGxheWluZyB0aGUgcXVhbnRpdHkgb2YgZWFjaCBwcm9kdWN0IG9uIHNlcGFyYXRlIGxpbmVzLlxuIiwNCiAgICAiXG4iLA0KICAgICJTb2x2ZSB0aGUgZXhlcmNpc2UgYnkgaW1wbGVtZW50aW5nIHRoZSBzdGVwcyB1c2luZyB0aGUgUHl0aG9uIGNvbmNlcHRzIG9mIGxpc3RzLCBkaWN0aW9uYXJpZXMsIHNldHMsIGFuZCBiYXNpYyBpbnB1dC9vdXRwdXQgb3BlcmF0aW9ucy4gIg0KICAgXQ0KICB9DQogXSwNCiAibWV0YWRhdGEiOiB7DQogICJrZXJuZWxzcGVjIjogew0KICAgImRpc3BsYXlfbmFtZSI6ICJQeXRob24gMyAoaXB5a2VybmVsKSIsDQogICAibGFuZ3VhZ2UiOiAicHl0aG9uIiwNCiAgICJuYW1lIjogInB5dGhvbjMiDQogIH0sDQogICJsYW5ndWFnZV9pbmZvIjogew0KICAgImNvZGVtaXJyb3JfbW9kZSI6IHsNCiAgICAibmFtZSI6ICJpcHl0aG9uIiwNCiAgICAidmVyc2lvbiI6IDMNCiAgIH0sDQogICAiZmlsZV9leHRlbnNpb24iOiAiLnB5IiwNCiAgICJtaW1ldHlwZSI6ICJ0ZXh0L3gtcHl0aG9uIiwNCiAgICJuYW1lIjogInB5dGhvbiIsDQogICAibmJjb252ZXJ0X2V4cG9ydGVyIjogInB5dGhvbiIsDQogICAicHlnbWVudHNfbGV4ZXIiOiAiaXB5dGhvbjMiLA0KICAgInZlcnNpb24iOiAiMy45LjEzIg0KICB9DQogfSwNCiAibmJmb3JtYXQiOiA0LA0KICJuYmZvcm1hdF9taW5vciI6IDQNCn0NCg==" \ No newline at end of file From 08a0f8d00bef7d7ac3962d3453d824629934da94 Mon Sep 17 00:00:00 2001 From: Andre Delgado Date: Sat, 19 Sep 2026 11:17:00 +0100 Subject: [PATCH 2/2] Week1Lab1 Done --- lab-python-data-structures.ipynb | 101 ++++++++++++++++++++++++++++++- 1 file changed, 100 insertions(+), 1 deletion(-) diff --git a/lab-python-data-structures.ipynb b/lab-python-data-structures.ipynb index 277a4f88..64459b9d 100644 --- a/lab-python-data-structures.ipynb +++ b/lab-python-data-structures.ipynb @@ -1 +1,100 @@ -"ew0KICJjZWxscyI6IFsNCiAgew0KICAgImNlbGxfdHlwZSI6ICJtYXJrZG93biIsDQogICAibWV0YWRhdGEiOiB7DQogICAgInRhZ3MiOiBbXQ0KICAgfSwNCiAgICJzb3VyY2UiOiBbDQogICAgIiMgTGFiIHwgRGF0YSBTdHJ1Y3R1cmVzICINCiAgIF0NCiAgfSwNCiAgew0KICAgImNlbGxfdHlwZSI6ICJtYXJrZG93biIsDQogICAibWV0YWRhdGEiOiB7fSwNCiAgICJzb3VyY2UiOiBbDQogICAgIiMjIEV4ZXJjaXNlOiBNYW5hZ2luZyBDdXN0b21lciBPcmRlcnNcbiIsDQogICAgIlxuIiwNCiAgICAiQXMgcGFydCBvZiBhIGJ1c2luZXNzIHZlbnR1cmUsIHlvdSBhcmUgc3RhcnRpbmcgYW4gb25saW5lIHN0b3JlIHRoYXQgc2VsbHMgdmFyaW91cyBwcm9kdWN0cy4gVG8gZW5zdXJlIHNtb290aCBvcGVyYXRpb25zLCB5b3UgbmVlZCB0byBkZXZlbG9wIGEgcHJvZ3JhbSB0aGF0IG1hbmFnZXMgY3VzdG9tZXIgb3JkZXJzIGFuZCBpbnZlbnRvcnkuXG4iLA0KICAgICJcbiIsDQogICAgIkZvbGxvdyB0aGUgc3RlcHMgYmVsb3cgdG8gY29tcGxldGUgdGhlIGV4ZXJjaXNlOlxuIiwNCiAgICAiXG4iLA0KICAgICIxLiBEZWZpbmUgYSBsaXN0IGNhbGxlZCBgcHJvZHVjdHNgIHRoYXQgY29udGFpbnMgdGhlIGZvbGxvd2luZyB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oZSB1cGRhdGVkIGludmVudG9yeSwgZGlzcGxheWluZyB0aGUgcXVhbnRpdHkgb2YgZWFjaCBwcm9kdWN0IG9uIHNlcGFyYXRlIGxpbmVzLlxuIiwNCiAgICAiXG4iLA0KICAgICJTb2x2ZSB0aGUgZXhlcmNpc2UgYnkgaW1wbGVtZW50aW5nIHRoZSBzdGVwcyB1c2luZyB0aGUgUHl0aG9uIGNvbmNlcHRzIG9mIGxpc3RzLCBkaWN0aW9uYXJpZXMsIHNldHMsIGFuZCBiYXNpYyBpbnB1dC9vdXRwdXQgb3BlcmF0aW9ucy4gIg0KICAgXQ0KICB9DQogXSwNCiAibWV0YWRhdGEiOiB7DQogICJrZXJuZWxzcGVjIjogew0KICAgImRpc3BsYXlfbmFtZSI6ICJQeXRob24gMyAoaXB5a2VybmVsKSIsDQogICAibGFuZ3VhZ2UiOiAicHl0aG9uIiwNCiAgICJuYW1lIjogInB5dGhvbjMiDQogIH0sDQogICJsYW5ndWFnZV9pbmZvIjogew0KICAgImNvZGVtaXJyb3JfbW9kZSI6IHsNCiAgICAibmFtZSI6ICJpcHl0aG9uIiwNCiAgICAidmVyc2lvbiI6IDMNCiAgIH0sDQogICAiZmlsZV9leHRlbnNpb24iOiAiLnB5IiwNCiAgICJtaW1ldHlwZSI6ICJ0ZXh0L3gtcHl0aG9uIiwNCiAgICJuYW1lIjogInB5dGhvbiIsDQogICAibmJjb252ZXJ0X2V4cG9ydGVyIjogInB5dGhvbiIsDQogICAicHlnbWVudHNfbGV4ZXIiOiAiaXB5dGhvbjMiLA0KICAgInZlcnNpb24iOiAiMy45LjEzIg0KICB9DQogfSwNCiAibmJmb3JtYXQiOiA0LA0KICJuYmZvcm1hdF9taW5vciI6IDQNCn0NCg==" \ No newline at end of file +{ + "metadata": { + "kernelspec": { + "name": "python", + "display_name": "Python (Pyodide)", + "language": "python" + }, + "language_info": { + "codemirror_mode": { + "name": "python", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8" + } + }, + "nbformat_minor": 4, + "nbformat": 4, + "cells": [ + { + "cell_type": "markdown", + "source": "# Lab | Data Structures ", + "metadata": { + "tags": [] + } + }, + { + "cell_type": "markdown", + "source": "## Exercise: Managing Customer Orders\n\nAs 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\nFollow the steps below to complete the exercise:\n\n1. Define a list called `products` that contains the following items: \"t-shirt\", \"mug\", \"hat\", \"book\", \"keychain\".\n\n2. Create an empty dictionary called `inventory`.\n\n3. 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\n4. Create an empty set called `customer_orders`.\n\n5. 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\n6. Print the products in the `customer_orders` set.\n\n7. 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\n8. Print the order statistics using the following format:\n ```\n Order Statistics:\n Total Products Ordered: \n Percentage of Products Ordered: % \n ```\n\n9. Update the inventory by subtracting 1 from the quantity of each product. Modify the `inventory` dictionary accordingly.\n\n10. Print the updated inventory, displaying the quantity of each product on separate lines.\n\nSolve the exercise by implementing the steps using the Python concepts of lists, dictionaries, sets, and basic input/output operations. ", + "metadata": {} + }, + { + "cell_type": "code", + "source": "products = [\"t-shirt\", \"mug\", \"hat\", \"book\", \"keychain\"]\n\ninventory = {}\n\nfor i in range(len(products)):\n quantity = int(input(f\"What's the number of {products[i]}:\"))\n inventory[products[i]] = quantity\n\nprint(inventory)", + "metadata": { + "trusted": true + }, + "outputs": [], + "execution_count": null + }, + { + "cell_type": "code", + "source": "customer_orders = set()\n\nfor i in range(3):\n while True:\n orders = input(\"Order your product: \").lower().strip()\n\n if orders not in products:\n print(\"Invalid Product, try again\")\n continue\n\n customer_orders.add(orders)\n break\n \nprint(customer_orders)", + "metadata": { + "trusted": true + }, + "outputs": [], + "execution_count": null + }, + { + "cell_type": "code", + "source": "total_products_ordered = len(customer_orders)\nprint(total_products_ordered)", + "metadata": { + "trusted": true + }, + "outputs": [], + "execution_count": null + }, + { + "cell_type": "code", + "source": "percentage_ordered = (len(customer_orders)/sum(inventory.values()))*100\nprint(f\"{percentage_ordered:.2f}%\")", + "metadata": { + "trusted": true + }, + "outputs": [], + "execution_count": null + }, + { + "cell_type": "code", + "source": "order_status = (\"Total Products Ordered:\",len(customer_orders),\"Percentage of Products Ordered:\",round((len(customer_orders)/sum(inventory.values()))*100))\nprint(order_status)", + "metadata": { + "trusted": true + }, + "outputs": [], + "execution_count": null + }, + { + "cell_type": "code", + "source": "print(\"Order Statistics:\")\nprint(f\"Total Products Ordered:{total_products_ordered}\")\nprint(f\"Percentage of Products Ordered: {percentage_ordered:.2f}%\") ", + "metadata": { + "trusted": true + }, + "outputs": [], + "execution_count": null + }, + { + "cell_type": "code", + "source": "for products in customer_orders:\n if products in inventory:\n inventory[products]-= 1\n\nprint(*inventory.items(),sep=\"\\n\")", + "metadata": { + "trusted": true + }, + "outputs": [], + "execution_count": null + } + ] +} \ No newline at end of file