diff --git a/Discount-calculator.ipynb b/Discount-calculator.ipynb new file mode 100644 index 0000000..811fff7 --- /dev/null +++ b/Discount-calculator.ipynb @@ -0,0 +1,62 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "eaa1b0a5", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Total Discount: 25.0\n", + "Total amount after discount : 475.0\n" + ] + } + ], + "source": [ + "amt = float(input(\"Enter the amt : \"))\n", + "\n", + "if amt >= 5000:\n", + " dis = 0.15\n", + "\n", + "elif amt >=1000:\n", + " dis = 0.10\n", + "\n", + "elif amt >=500:\n", + " dis = 0.05\n", + "\n", + "else:\n", + " print(\"Invalid amount\")\n", + "\n", + "discount = amt * dis\n", + "final_amt = amt - discount\n", + "\n", + "print(\"Total Discount:\",discount)\n", + "print(\"Total amount after discount : \" ,final_amt)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "base", + "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.13.9" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/pyt_pragati_3rdyear-10-03-26.ipynb b/pyt_pragati_3rdyear-10-03-26.ipynb new file mode 100644 index 0000000..7217ceb --- /dev/null +++ b/pyt_pragati_3rdyear-10-03-26.ipynb @@ -0,0 +1,106 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 20, + "id": "ef72a8f1", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "This is invalid number\n" + ] + } + ], + "source": [ + "try:\n", + " num = int(input(\"Enter the number: \"))\n", + "\n", + " check = 10 / num \n", + "\n", + " if num % 2 == 0:\n", + " print(\"This is even number\")\n", + " else:\n", + " print(\"This is odd number\")\n", + "\n", + "except ZeroDivisionError:\n", + " print(\"Zero error: number cannot be zero\")\n", + "\n", + "except ValueError:\n", + " print(\"This is invalid number\")" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "3135ee42", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Even number\n", + "\n", + "Final Report\n", + "Event Numbers: 1\n", + "odd Number: 0\n", + "Invalid input 0\n" + ] + } + ], + "source": [ + "data = input(\"Enter the number : \").split()\n", + "\n", + "# counters\n", + "even_count = 0\n", + "odd_count = 0\n", + "invalid_count = 0\n", + "\n", + "for i in data:\n", + " try:\n", + " num = int(i)\n", + "\n", + " if num % 2 == 0:\n", + " print(\"Even number\")\n", + " even_count += 1\n", + " else:\n", + " print(\"Odd Number\")\n", + " odd_count +=1\n", + "\n", + " except:\n", + " print(i,\"is invalid, skipped\")\n", + " invalid_count += 1\n", + "\n", + "print(\"\\nFinal Report\")\n", + "print(\"Event Numbers:\",even_count)\n", + "print(\"odd Number:\",odd_count)\n", + "print(\"Invalid input\",invalid_count)\n", + " " + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "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.12.4" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/pyt_pragati_3rdyear-11-03-26.ipynb b/pyt_pragati_3rdyear-11-03-26.ipynb new file mode 100644 index 0000000..e69de29 diff --git a/pyt_pragati_3rdyear-12-03-26.ipynb b/pyt_pragati_3rdyear-12-03-26.ipynb new file mode 100644 index 0000000..e69de29 diff --git a/task1.ipynb b/task1.ipynb new file mode 100644 index 0000000..9a29c42 --- /dev/null +++ b/task1.ipynb @@ -0,0 +1,309 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "7ec1157c", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Continue... Enter again\n", + "Continue... Enter again\n", + "THIS IS END THE PROGRAM\n" + ] + } + ], + "source": [ + "while True:\n", + " num = int(input(\"Enter a number: \"))\n", + "\n", + " if num == 9:\n", + " print(\"THIS IS END THE PROGRAM\")\n", + " break\n", + " else:\n", + " print(\"Continue... Enter again\")" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "549d9efb", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Continue... Enter again\n", + "Continue... Enter again\n", + "Stop\n" + ] + } + ], + "source": [ + "def Animal():\n", + " while True:\n", + " animal = (input(\"Enter the name of the animal :\"))\n", + " if animal == \"Elephent\":\n", + " print(\"Stop\")\n", + " break\n", + "\n", + " elif animal == \"Cat\":\n", + " print(\"This is cat\")\n", + "\n", + " elif animal == \"Dog\":\n", + " print(\"This is Dog\")\n", + "\n", + " else :\n", + " print(\"Continue... Enter again\")\n", + "\n", + "# # function call\n", + "Animal()" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "f7808f27", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Element in 0 Position of the list : 1\n", + "Element in 1 Position of the list : pragti\n", + "Element in 2 Position of the list : 2.12\n", + "Element in 3 Position of the list : nagpur\n" + ] + } + ], + "source": [ + "# white a python program that uses the 'for' loop for \n", + "# iterating through list of elemnts and\n", + "# prints all the element present in that list\n", + "\n", + "list = [1,\"pragti\",2.12,\"nagpur\"]\n", + "number = len(list)\n", + "for i in range(number):\n", + " print(f\"Element in {i} Position of the list : {list[i]}\")" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "120949dc", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "item1:pen\n", + "item2:pencile\n", + "item3:Ereser\n" + ] + } + ], + "source": [ + "new_dict ={\"item1\": \"pen\" ,\"item2\" : \"pencile\",\"item3\": \"Ereser\"}\n", + "for i,j in new_dict.items():\n", + " print(f\"{i}:{j}\")\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "536c6026", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1\n", + "2\n", + "3\n", + "4\n", + "5\n", + "6\n" + ] + } + ], + "source": [ + "# defiene a list and define the search atom\n", + "\n", + "list_items = {1,2,3,4,5,6,7,8}\n", + "search_atom = 7\n", + "for i in list_items:\n", + " if i == search_atom:\n", + " break\n", + " else:\n", + " print(i)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "id": "7d408acf", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Original List = [10, 15, 20, 30, 40, 50, 60]\n", + "After append = [10, 20, 30, 40]\n", + "After extend = [10, 20, 30, 40, 50, 60]\n", + "After insert = [10, 15, 20, 30, 40, 50, 60]\n" + ] + } + ], + "source": [ + "# use append function in the list\n", + "# use the extend & insert function in the list \n", + "# observe the difference in the outputs afterwards\n", + "\n", + "# original list\n", + "List = [10, 20, 30]\n", + "print(\"Original List =\", L)\n", + "\n", + "# 1️⃣ append() → single element add karta hai end me\n", + "List.append(40)\n", + "print(\"After append =\", List)\n", + "\n", + "# 2️⃣ extend() → dusri list ke sab elements add karta hai\n", + "M = [50, 60]\n", + "List.extend(M)\n", + "print(\"After extend =\", List)\n", + "\n", + "# 3️⃣ insert() → specific position pe element add karta hai\n", + "List.insert(1, 15)\n", + "print(\"After insert =\", List)\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "id": "f2e26448", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "List of squares = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144]\n" + ] + } + ], + "source": [ + "# populate the list with the squre of the number between 1-12\n", + "list = []\n", + "for num in range (1,13):\n", + " square = num * num\n", + " list.append(square)\n", + "\n", + "# display result\n", + "print(\"List of squares =\", list)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "id": "eb0255c0", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144]\n" + ] + } + ], + "source": [ + "list = []\n", + "for i in range (1,13):\n", + " list.append(i*i)\n", + "\n", + "print(list)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "id": "1f0af2bb", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144]" + ] + }, + "execution_count": 19, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "list_of_sqr = [x * x for x in range(1,13)]\n", + "list_of_sqr" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "id": "6b908e3c", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "After sort() = [10, 20, 30, 40, 50]\n", + "After remove(30) = [10, 20, 40, 50]\n", + "After pop(1) = [10, 40, 50]\n" + ] + } + ], + "source": [ + "# use the sort(),pop(),remove() fumction in the list of squere that have created\n", + "my_list = [10, 20, 30, 40, 50]\n", + "my_list.sort()\n", + "print(\"After sort() =\", my_list)\n", + "my_list.remove(30)\n", + "print(\"After remove(30) =\", my_list)\n", + "my_list.pop(1)\n", + "print(\"After pop(1) =\", my_list)\n", + "\n", + "\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "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.12.4" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}