diff --git a/Notebook1.ipynb b/Notebook1.ipynb index f080647..be05784 100644 --- a/Notebook1.ipynb +++ b/Notebook1.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": 2, "id": "73fb95c9", "metadata": {}, "outputs": [ @@ -10,28 +10,138 @@ "name": "stdout", "output_type": "stream", "text": [ - "7\n" + "6\n" ] } ], "source": [ "x = 3\n", - "y = 4\n", + "y = 3\n", "print(x + y)" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, + "id": "d33f497c", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "PIYUSH\n", + "2\n", + "5.4\n" + ] + } + ], + "source": [ + "var=\"PIYUSH\"\n", + "var2=2\n", + "var3=5.4\n", + "print(var)\n", + "print(var2)\n", + "print(var3)\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 5, "id": "ca9af74b", "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "list is contain number: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n", + "dict is contain differnt types of values: {1: 'Piyush', 2: 67, 3: 59.78, 4: True, 5: None}\n" + ] + } + ], + "source": [ + "list=[1,2,3,4,5,6,7,8,9,10]\n", + "dict={1:\"Piyush\",2:67,3:59.78,4:True,5:None}\n", + "print(\"list is contain number:\",list)\n", + "print(\"dict is contain differnt types of values: \",dict)" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "da81af67", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{None, True, False, 67, 'a', 45, 78, 23, 56, 'piyush'}\n" + ] + } + ], + "source": [ + "lista=[23,45,56,23,45,45,67,78,\"a\",\"piyush\",\"piyush\",None,True,True,False,\"a\",False]\n", + "set_lista=set(lista)\n", + "print(set_lista)\n", + "tuple_lista=tuple(lista)\n", + "\n", + "\n", + "# tht s cmnbkxcbhbxchjzbcjh vac \n", + "# bnvjhgSJDbcjhsd bvcjh \n", + "# sdnbvhcgsdycvuisbvk" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d291a094", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "12.2\n", + "12.2\n", + "12\n", + "True\n" + ] + }, + { + "ename": "NameError", + "evalue": "name 'date' is not defined", + "output_type": "error", + "traceback": [ + "\u001b[31m---------------------------------------------------------------------------\u001b[39m", + "\u001b[31mNameError\u001b[39m Traceback (most recent call last)", + "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[12]\u001b[39m\u001b[32m, line 13\u001b[39m\n\u001b[32m 10\u001b[39m str_bool=\u001b[38;5;28mbool\u001b[39m(\u001b[38;5;28mstr\u001b[39m)\n\u001b[32m 11\u001b[39m \u001b[38;5;28mprint\u001b[39m(str_bool)\n\u001b[32m---> \u001b[39m\u001b[32m13\u001b[39m str_date=\u001b[43mdate\u001b[49m(\u001b[38;5;28mstr\u001b[39m)\n\u001b[32m 14\u001b[39m \u001b[38;5;28mprint\u001b[39m(str_date)\n", + "\u001b[31mNameError\u001b[39m: name 'date' is not defined" + ] + } + ], + "source": [ + "str=\"12.2\"\n", + "print(str)\n", + "\n", + "str_float=float(str)\n", + "print(str)\n", + "\n", + "float_int=int(str_float)\n", + "print(float_int)\n", + "\n", + "str_bool=bool(str)\n", + "print(str_bool)\n", + "\n", + "\n" + ] } ], "metadata": { "kernelspec": { - "display_name": "myenv", + "display_name": "pyt101", "language": "python", "name": "python3" }, @@ -45,7 +155,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.13.7" + "version": "3.14.2" } }, "nbformat": 4, diff --git a/Notebooktask1.ipynb b/Notebooktask1.ipynb new file mode 100644 index 0000000..e6cd731 --- /dev/null +++ b/Notebooktask1.ipynb @@ -0,0 +1,61 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 2, + "id": "4eacdf0b", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Welcome to the discount calculator!\n", + "Total discount : 150.0\n", + "Total amount after discount:850.0\n" + ] + } + ], + "source": [ + "# create a CLI based discount calculator \n", + "print(\"Welcome to the discount calculator!\")\n", + "amount = float(input(\"Enter the original amount: \"))\n", + "if amount > 500:\n", + " discount = 0.15\n", + "\n", + "elif amount > 1000:\n", + " discount = 0.10\n", + "\n", + "elif amount > 5000:\n", + " discount = 0.06\n", + "\n", + "else:\n", + " print(\"Invalid amount\")\n", + " \n", + "\n", + "print(f\"Total discount : {discount*amount}\\nTotal amount after discount:{amount-discount*amount}\")" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "pyt101", + "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 +}