diff --git a/lab-python-data-structures.ipynb b/lab-python-data-structures.ipynb index 5b3ce9e0..7c1759fa 100644 --- a/lab-python-data-structures.ipynb +++ b/lab-python-data-structures.ipynb @@ -50,11 +50,242 @@ "\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": 61, + "metadata": {}, + "outputs": [], + "source": [ + "# This is Kyle Solving the Lab" + ] + }, + { + "cell_type": "code", + "execution_count": 62, + "metadata": {}, + "outputs": [], + "source": [ + "products= [\"t-shirt\", \"mug\", \"hat\", \"book\", \"keychain\"]" + ] + }, + { + "cell_type": "code", + "execution_count": 63, + "metadata": {}, + "outputs": [], + "source": [ + "inventory={}" + ] + }, + { + "cell_type": "code", + "execution_count": 64, + "metadata": {}, + "outputs": [], + "source": [ + "t_shirt_quantity=int(input(\"Enter the quantity of t-shirsts:\"))\n", + "mug_quantity=int(input(\"Enter the quantity of mugs:\"))\n", + "hat_quantity=int(input(\"Enter the quantity of hats:\"))\n", + "book_quantity=int(input(\"Enter the quantity of mugs:\"))\n", + "keychain_quantity=int(input(\"Enter the quantity of keychains:\"))" + ] + }, + { + "cell_type": "code", + "execution_count": 65, + "metadata": {}, + "outputs": [], + "source": [ + "inventory={\"t-shirt\": t_shirt_quantity, \n", + "\"mug\": mug_quantity, \n", + "\"hat\": hat_quantity, \n", + "\"book\": book_quantity, \n", + "\"keychain\": keychain_quantity }" + ] + }, + { + "cell_type": "code", + "execution_count": 66, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'t-shirt': 5, 'mug': 5, 'hat': 5, 'book': 5, 'keychain': 5}" + ] + }, + "execution_count": 66, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "inventory" + ] + }, + { + "cell_type": "code", + "execution_count": 67, + "metadata": {}, + "outputs": [], + "source": [ + "customer_orders={}" + ] + }, + { + "cell_type": "code", + "execution_count": 68, + "metadata": {}, + "outputs": [], + "source": [ + "order_1=input(\"Please enter a product to order:\")\n", + "order_2= input(\"Please enter a product to order:\")\n", + "order_3=input(\"Please enter a product to order:\")\n", + "order_= input(\"Please enter a product to order:\")\n" + ] + }, + { + "cell_type": "code", + "execution_count": 69, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'mug', 'keychain', 'hat'}\n" + ] + } + ], + "source": [ + "customer_orders={order_1, order_2, order_3}\n", + "print(customer_orders)" + ] + }, + { + "cell_type": "code", + "execution_count": 70, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(3, 60.0)\n" + ] + } + ], + "source": [ + "products_ordered= len(customer_orders)\n", + "percentage_ordered= len(customer_orders)/len(products)*100\n", + "order_statistics=(products_ordered, percentage_ordered,)\n", + "print(order_statistics)" + ] + }, + { + "cell_type": "code", + "execution_count": 74, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'t-shirt': 3, 'mug': 3, 'hat': 3, 'book': 3, 'keychain': 3}\n" + ] + } + ], + "source": [ + "inventory[\"t-shirt\"]=inventory[\"t-shirt\"]-1\n", + "inventory[\"mug\"]=inventory[\"mug\"]-1\n", + "inventory[\"book\"]=inventory[\"book\"]-1\n", + "inventory[\"hat\"]=inventory[\"hat\"]-1\n", + "inventory[\"keychain\"]=inventory[\"keychain\"]-1\n", + "print(inventory)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "Python 3", "language": "python", "name": "python3" }, @@ -68,7 +299,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.9.10" } }, "nbformat": 4,