diff --git a/.ipynb_checkpoints/Laboratotio1-checkpoint.ipynb b/.ipynb_checkpoints/Laboratotio1-checkpoint.ipynb new file mode 100644 index 00000000..df2c9d71 --- /dev/null +++ b/.ipynb_checkpoints/Laboratotio1-checkpoint.ipynb @@ -0,0 +1,97 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "24be373f-9e4a-4af9-a503-823fe4092df2", + "metadata": {}, + "outputs": [], + "source": [ + "#Exercise: Managing customers orders\n", + "\n", + "\n", + "products = [\"t-shirt\", \"mug\", \"hat\", \"book\", \"keychain\"]\n", + "\n", + "inventory = {}\n", + "\n", + "quantity = int(input(\"Select the quantity of t-shirts to add to inventory: \"))\n", + "inventory[\"t-shirt\"] = quantity\n", + "\n", + "quantity = int(input(\"Select the quantity of mug to add to inventory: \"))\n", + "inventory[\"mug\"] = quantity\n", + "\n", + "quantity = int(input(\"Select the quantity of hat to add to inventory: \"))\n", + "inventory[\"hat\"] = quantity\n", + "\n", + "quantity = int(input(\"Select the quantity of book to add to inventory: \"))\n", + "inventory[\"book\"] = quantity\n", + "\n", + "quantity = int(input(\"Select the quantity of keychain to add to inventory: \"))\n", + "inventory[\"keychain\"] = quantity\n", + "\n", + "\n", + "customer_orders = set()\n", + "\n", + "product_name = input(\"Enter the name of a product the customer wants to order: \")\n", + "customer_orders.add(product_name)\n", + "\n", + "product_name = input(\"Enter the name of a product the customer wants to order: \")\n", + "customer_orders.add(product_name)\n", + "\n", + "product_name = input(\"Enter the name of a product the customer wants to order: \")\n", + "customer_orders.add(product_name)\n", + "\n", + "print(\"Products in customer orders:\", customer_orders)\n", + "\n", + "total_products_ordered = len(customer_orders)\n", + "percentage_ordered = (total_products_ordered / len(products)) * 100\n", + "\n", + "print(\"Order Statistics\")\n", + "print(\"total products ordered:\", total_products_ordered)\n", + "print(\"percentage of products ordered:\", percentage_ordered)\n", + "\n", + "for product_name in customer_orders:\n", + " if product_name in inventory:\n", + " inventory[product_name] -= 1\n", + " else:\n", + " print(f\"Product '{product_name}' not found in inventory\")\n", + "\n", + "print(\"Updated inventory:\")\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\"])\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "137dfc23-5997-4424-a54e-eafc78341ee7", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "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.14.2" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/.ipynb_checkpoints/lab-python-data-structures-checkpoint.ipynb b/.ipynb_checkpoints/lab-python-data-structures-checkpoint.ipynb new file mode 100644 index 00000000..9ce1c38a --- /dev/null +++ b/.ipynb_checkpoints/lab-python-data-structures-checkpoint.ipynb @@ -0,0 +1,76 @@ +{ + "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.14.2" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/.ipynb_checkpoints/lab-python-data-structures-checkpoint.py b/.ipynb_checkpoints/lab-python-data-structures-checkpoint.py new file mode 100644 index 00000000..5b3ce9e0 --- /dev/null +++ b/.ipynb_checkpoints/lab-python-data-structures-checkpoint.py @@ -0,0 +1,76 @@ +{ + "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 +} diff --git a/Laboratotio1.ipynb b/Laboratotio1.ipynb new file mode 100644 index 00000000..da41d99d --- /dev/null +++ b/Laboratotio1.ipynb @@ -0,0 +1,111 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "24be373f-9e4a-4af9-a503-823fe4092df2", + "metadata": {}, + "outputs": [ + { + "ename": "KeyboardInterrupt", + "evalue": "Interrupted by user", + "output_type": "error", + "traceback": [ + "\u001b[31m---------------------------------------------------------------------------\u001b[39m", + "\u001b[31mKeyboardInterrupt\u001b[39m Traceback (most recent call last)", + "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[1]\u001b[39m\u001b[32m, line 8\u001b[39m\n\u001b[32m 4\u001b[39m products = [\u001b[33m\"\u001b[39m\u001b[33mt-shirt\u001b[39m\u001b[33m\"\u001b[39m, \u001b[33m\"\u001b[39m\u001b[33mmug\u001b[39m\u001b[33m\"\u001b[39m, \u001b[33m\"\u001b[39m\u001b[33mhat\u001b[39m\u001b[33m\"\u001b[39m, \u001b[33m\"\u001b[39m\u001b[33mbook\u001b[39m\u001b[33m\"\u001b[39m, \u001b[33m\"\u001b[39m\u001b[33mkeychain\u001b[39m\u001b[33m\"\u001b[39m]\n\u001b[32m 6\u001b[39m inventory = {}\n\u001b[32m----> \u001b[39m\u001b[32m8\u001b[39m quantity = \u001b[38;5;28mint\u001b[39m(\u001b[38;5;28;43minput\u001b[39;49m\u001b[43m(\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mSelect the quantity of t-shirts to add to inventory: \u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m)\u001b[49m)\n\u001b[32m 9\u001b[39m inventory[\u001b[33m\"\u001b[39m\u001b[33mt-shirt\u001b[39m\u001b[33m\"\u001b[39m] = quantity\n\u001b[32m 11\u001b[39m quantity = \u001b[38;5;28mint\u001b[39m(\u001b[38;5;28minput\u001b[39m(\u001b[33m\"\u001b[39m\u001b[33mSelect the quantity of mug to add to inventory: \u001b[39m\u001b[33m\"\u001b[39m))\n", + "\u001b[36mFile \u001b[39m\u001b[32m~\\AppData\\Roaming\\Python\\Python314\\site-packages\\ipykernel\\kernelbase.py:1396\u001b[39m, in \u001b[36mKernel.raw_input\u001b[39m\u001b[34m(self, prompt)\u001b[39m\n\u001b[32m 1394\u001b[39m msg = \u001b[33m\"\u001b[39m\u001b[33mraw_input was called, but this frontend does not support input requests.\u001b[39m\u001b[33m\"\u001b[39m\n\u001b[32m 1395\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m StdinNotImplementedError(msg)\n\u001b[32m-> \u001b[39m\u001b[32m1396\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_input_request\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m 1397\u001b[39m \u001b[43m \u001b[49m\u001b[38;5;28;43mstr\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mprompt\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1398\u001b[39m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_get_shell_context_var\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_shell_parent_ident\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1399\u001b[39m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43mget_parent\u001b[49m\u001b[43m(\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mshell\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1400\u001b[39m \u001b[43m \u001b[49m\u001b[43mpassword\u001b[49m\u001b[43m=\u001b[49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[32m 1401\u001b[39m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n", + "\u001b[36mFile \u001b[39m\u001b[32m~\\AppData\\Roaming\\Python\\Python314\\site-packages\\ipykernel\\kernelbase.py:1441\u001b[39m, in \u001b[36mKernel._input_request\u001b[39m\u001b[34m(self, prompt, ident, parent, password)\u001b[39m\n\u001b[32m 1438\u001b[39m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mKeyboardInterrupt\u001b[39;00m:\n\u001b[32m 1439\u001b[39m \u001b[38;5;66;03m# re-raise KeyboardInterrupt, to truncate traceback\u001b[39;00m\n\u001b[32m 1440\u001b[39m msg = \u001b[33m\"\u001b[39m\u001b[33mInterrupted by user\u001b[39m\u001b[33m\"\u001b[39m\n\u001b[32m-> \u001b[39m\u001b[32m1441\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mKeyboardInterrupt\u001b[39;00m(msg) \u001b[38;5;28;01mfrom\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[32m 1442\u001b[39m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mException\u001b[39;00m:\n\u001b[32m 1443\u001b[39m \u001b[38;5;28mself\u001b[39m.log.warning(\u001b[33m\"\u001b[39m\u001b[33mInvalid Message:\u001b[39m\u001b[33m\"\u001b[39m, exc_info=\u001b[38;5;28;01mTrue\u001b[39;00m)\n", + "\u001b[31mKeyboardInterrupt\u001b[39m: Interrupted by user" + ] + } + ], + "source": [ + "#Exercise: Managing customers orders\n", + "\n", + "\n", + "products = [\"t-shirt\", \"mug\", \"hat\", \"book\", \"keychain\"]\n", + "\n", + "inventory = {}\n", + "\n", + "quantity = int(input(\"Select the quantity of t-shirts to add to inventory: \"))\n", + "inventory[\"t-shirt\"] = quantity\n", + "\n", + "quantity = int(input(\"Select the quantity of mug to add to inventory: \"))\n", + "inventory[\"mug\"] = quantity\n", + "\n", + "quantity = int(input(\"Select the quantity of hat to add to inventory: \"))\n", + "inventory[\"hat\"] = quantity\n", + "\n", + "quantity = int(input(\"Select the quantity of book to add to inventory: \"))\n", + "inventory[\"book\"] = quantity\n", + "\n", + "quantity = int(input(\"Select the quantity of keychain to add to inventory: \"))\n", + "inventory[\"keychain\"] = quantity\n", + "\n", + "\n", + "customer_orders = set()\n", + "\n", + "product_name = input(\"Enter the name of a product the customer wants to order: \")\n", + "customer_orders.add(product_name)\n", + "\n", + "product_name = input(\"Enter the name of a product the customer wants to order: \")\n", + "customer_orders.add(product_name)\n", + "\n", + "product_name = input(\"Enter the name of a product the customer wants to order: \")\n", + "customer_orders.add(product_name)\n", + "\n", + "print(\"Products in customer orders:\", customer_orders)\n", + "\n", + "total_products_ordered = len(customer_orders)\n", + "percentage_ordered = (total_products_ordered / len(products)) * 100\n", + "\n", + "print(\"Order Statistics\")\n", + "print(\"total products ordered:\", total_products_ordered)\n", + "print(\"percentage of products ordered:\", percentage_ordered)\n", + "\n", + "for product_name in customer_orders:\n", + " if product_name in inventory:\n", + " inventory[product_name] -= 1\n", + " else:\n", + " print(f\"Product '{product_name}' not found in inventory\")\n", + "\n", + "print(\"Updated inventory:\")\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\"])\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "137dfc23-5997-4424-a54e-eafc78341ee7", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "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.14.2" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/lab-python-data-structures.ipynb b/lab-python-data-structures.ipynb index 5b3ce9e0..9ce1c38a 100644 --- a/lab-python-data-structures.ipynb +++ b/lab-python-data-structures.ipynb @@ -68,7 +68,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.14.2" } }, "nbformat": 4, diff --git a/lab-python-data-structures.py b/lab-python-data-structures.py new file mode 100644 index 00000000..09288fdc --- /dev/null +++ b/lab-python-data-structures.py @@ -0,0 +1,177 @@ +{ + "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": 1, + "metadata": {}, + "outputs": [ + { + "name": "stdin", + "output_type": "stream", + "text": [ + "Select the quantity of t-shirts to add to inventory: 25\n", + "Select the quantity of mug to add to inventory: 15\n", + "Select the quantity of hat to add to inventory: 154\n", + "Select the quantity of book to add to inventory: 45\n", + "Select the quantity of keychain to add to inventory: 63\n", + "Enter the name of a product the customer wants to order: hat\n", + "Enter the name of a product the customer wants to order: book\n", + "Enter the name of a product the customer wants to order: mug\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Products in customer orders: {'book', 'mug', 'hat'}\n", + "Order Statistics\n", + "total products ordered: 3\n", + "percentage of products ordered: 60.0\n", + "Updated inventory:\n", + "T-shirt: 25\n", + "Mug: 14\n", + "Hat: 153\n", + "Book: 44\n", + "Keychain: 63\n" + ] + } + ], + "source": [ + "#Exercise: Managing customers orders\n", + "\n", + "\n", + "products = [\"t-shirt\", \"mug\", \"hat\", \"book\", \"keychain\"]\n", + "\n", + "inventory = {}\n", + "\n", + "quantity = int(input(\"Select the quantity of t-shirts to add to inventory: \"))\n", + "inventory[\"t-shirt\"] = quantity\n", + "\n", + "quantity = int(input(\"Select the quantity of mug to add to inventory: \"))\n", + "inventory[\"mug\"] = quantity\n", + "\n", + "quantity = int(input(\"Select the quantity of hat to add to inventory: \"))\n", + "inventory[\"hat\"] = quantity\n", + "\n", + "quantity = int(input(\"Select the quantity of book to add to inventory: \"))\n", + "inventory[\"book\"] = quantity\n", + "\n", + "quantity = int(input(\"Select the quantity of keychain to add to inventory: \"))\n", + "inventory[\"keychain\"] = quantity\n", + "\n", + "\n", + "customer_orders = set()\n", + "\n", + "product_name = input(\"Enter the name of a product the customer wants to order: \")\n", + "customer_orders.add(product_name)\n", + "\n", + "product_name = input(\"Enter the name of a product the customer wants to order: \")\n", + "customer_orders.add(product_name)\n", + "\n", + "product_name = input(\"Enter the name of a product the customer wants to order: \")\n", + "customer_orders.add(product_name)\n", + "\n", + "print(\"Products in customer orders:\", customer_orders)\n", + "\n", + "total_products_ordered = len(customer_orders)\n", + "percentage_ordered = (total_products_ordered / len(products)) * 100\n", + "\n", + "print(\"Order Statistics\")\n", + "print(\"total products ordered:\", total_products_ordered)\n", + "print(\"percentage of products ordered:\", percentage_ordered)\n", + "\n", + "for product_name in customer_orders:\n", + " if product_name in inventory:\n", + " inventory[product_name] -= 1\n", + " else:\n", + " print(f\"Product '{product_name}' not found in inventory\")\n", + "\n", + "print(\"Updated inventory:\")\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\"])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "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.14.2" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +}