diff --git a/lab-python-data-structures.ipynb b/lab-python-data-structures.ipynb index 5b3ce9e0..2885853c 100644 --- a/lab-python-data-structures.ipynb +++ b/lab-python-data-structures.ipynb @@ -50,11 +50,53 @@ "\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": [ + "products= [\"t-shirt\",\"mug\",\"hat\",\"book\",\"keychain\"]\n", + "inventory= {}\n", + "t_shirt=int(input(\"Enter the quantity of t-shirt:\"))\n", + "mug=int(input(\"Enter the quantity of mug:\"))\n", + "hat= int(input(\"Number of hats?\"))\n", + "book= int(input(\"Number of books?\"))\n", + "keychain= int(input(\"Number of keychains?\"))\n", + "inventory['t-shirt']=t_shirt\n", + "inventory['mug']=mug\n", + "inventory['hat']=hat\n", + "inventory['book']=book\n", + "inventory['keychain']=keychain\n", + "print(inventory)\n", + "customer_orders= set()\n", + "my_list=input(\"Which 3 items do you want? t-shirt, mug, hat, book or keychain?\").lower()\n", + "split_list=my_list.split(\",\")\n", + "print(split_list)\n", + "customer_orders.update(split_list)\n", + "total_products_ordered=len(customer_orders)\n", + "print(total_products_ordered)\n", + "percentage= len(customer_orders)/len(products)*100\n", + "print( f\"Tthe percentage is {percentage}%\")\n", + "order_status=(percentage,)\n", + "print(order_status)\n", + "print(\"Order Statistics:\")\n", + "print(f\"Total Products Ordered:{total_products_ordered}\")\n", + "print(f\"Percentage of Products Ordered:{percentage}%\")\n", + "\n", + "for item in products:\n", + " if item in inventory:\n", + " inventory[item]-=1\n", + "\n", + "for key, value in inventory.items():\n", + " print(key,value)" + ] } ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "base", "language": "python", "name": "python3" }, @@ -68,7 +110,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.13.5" } }, "nbformat": 4,