diff --git a/.gitignore b/.gitignore index 95ac68d..15f962b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ # Virtual environments -myenv/ +pyt101/ venv/ .env/ @@ -23,3 +23,5 @@ Thumbs.db # Secrets .env + + diff --git a/Discount_calc.ipynb b/Discount_calc.ipynb new file mode 100644 index 0000000..e69de29 diff --git a/Notebook1.ipynb b/Notebook1.ipynb index f080647..ded16ad 100644 --- a/Notebook1.ipynb +++ b/Notebook1.ipynb @@ -10,28 +10,114 @@ "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": 2, + "id": "20b4d1be", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Python\n", + "95\n", + "77.5\n", + "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n", + "{'name': 'Sharwari', 'age': 22, 'city': 'Nagpur', 'Height': 5.5}\n" + ] + } + ], + "source": [ + "subject = \"Python\"\n", + "marks = 95\n", + "percentage = 77.5\n", + "list1 = [1, 2, 3, 4, 5,6,7,8,9,10]\n", + "dict1 = {\"name\": \"Sharwari\", \"age\": 22, \"city\": \"Nagpur\", \"Height\": 5.5}\n", + "print(subject)\n", + "print(marks)\n", + "print(percentage)\n", + "print(list1)\n", + "print(dict1)" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "id": "e4fd482d", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{11, 12, 13, 14, 15, 'b', 'a', 'c'}\n", + "[11, 12, 13, 14, 15, 14, 11, 'a', 'b', 'c', 'a']\n", + "10.0\n", + "10\n", + "10\n", + "True\n" + ] + } + ], + "source": [ + "list2 = [11, 12, 13, 14, 15 ,14, 11,\"a\", \"b\", \"c\", \"a\"] \n", + "print(set(list2))\n", + "print(list(tuple(list2)))\n", + "price_str = \"10\"\n", + "price_float = float(price_str)\n", + "print(price_float)\n", + "price_int = int(price_float)\n", + "print(price_int)\n", + "price_int = int(price_str)\n", + "print(price_int)\n", + "print(bool(price_str))" + ] + }, { "cell_type": "code", "execution_count": null, - "id": "ca9af74b", + "id": "ecdad8a4", "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "You got 20% discount! Your discount amount is:800.0\n", + "Your final amount is: 3200.0\n" + ] + } + ], + "source": [ + "input_str =float(input(\"Enter a amount: \")) \n", + "if input_str > 1200: \n", + " discount = 0.2 * float(input_str)\n", + " amt = float(input_str) - discount\n", + " print(f\"You got 20% discount! Your discount amount is:{discount}\")\n", + " print(f\"Your final amount is: {amt}\")\n", + "elif input_str > 800: \n", + " discount = 0.1 * float(input_str)\n", + " print(f\"You got 10% discount! Your discount amount is:{discount}\")\n", + " print(f\"Your final amount is: {amt}\")\n", + "else:\n", + " print(\"You are not eligible for any discount.\")" + ] } ], "metadata": { "kernelspec": { - "display_name": "myenv", + "display_name": "Python 3", "language": "python", "name": "python3" }, @@ -45,7 +131,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.13.7" + "version": "3.11.9" } }, "nbformat": 4,