From 0ae02963246b7c671386ce52eefb291eefd0be11 Mon Sep 17 00:00:00 2001 From: KanakC2 Date: Tue, 10 Mar 2026 16:20:10 +0530 Subject: [PATCH 1/3] 9-3-26 --- Notebook1.ipynb | 92 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 88 insertions(+), 4 deletions(-) diff --git a/Notebook1.ipynb b/Notebook1.ipynb index f080647..dbc9433 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": [ @@ -22,16 +22,100 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 23, + "id": "9d30ab5c", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "10.55\n" + ] + } + ], + "source": [ + "#convert str to int\n", + "price_str = \"10.55\"\n", + "price_int = (price_str)\n", + "print(price_int)" + ] + }, + { + "cell_type": "code", + "execution_count": 24, "id": "ca9af74b", "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{1, 2, 3, 4, 5}\n" + ] + } + ], + "source": [ + "my_list = [1,2,3,4,5]\n", + "my_set = set(my_list)\n", + "\n", + "print(my_set)" + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "id": "caf11966", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "80\n" + ] + } + ], + "source": [ + "#convert str to float\n", + "price_str = \"80\"\n", + "price_float =(price_str)\n", + "print (price_float)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "aed75a98", + "metadata": {}, "outputs": [], "source": [] + }, + { + "cell_type": "code", + "execution_count": 39, + "id": "9386516d", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "80\n" + ] + } + ], + "source": [ + "#convert float to int\n", + "price_int = \"10.78\"\n", + "price_int = (price_float)\n", + "print (price_int)" + ] } ], "metadata": { "kernelspec": { - "display_name": "myenv", + "display_name": "pyt101 (3.13.12)", "language": "python", "name": "python3" }, @@ -45,7 +129,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.13.7" + "version": "3.13.12" } }, "nbformat": 4, From 57a51c6343aedaef97e313c05f8a64d3ed5e295c Mon Sep 17 00:00:00 2001 From: KanakC2 Date: Wed, 11 Mar 2026 16:49:20 +0530 Subject: [PATCH 2/3] 11/03/26 task 3 --- tasks/python_10-3-26.ipynb | 116 ++++++++++++++++++++ tasks/python_11-3-26.ipynb | 212 +++++++++++++++++++++++++++++++++++++ 2 files changed, 328 insertions(+) create mode 100644 tasks/python_10-3-26.ipynb create mode 100644 tasks/python_11-3-26.ipynb diff --git a/tasks/python_10-3-26.ipynb b/tasks/python_10-3-26.ipynb new file mode 100644 index 0000000..a56bd58 --- /dev/null +++ b/tasks/python_10-3-26.ipynb @@ -0,0 +1,116 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "b95d1ce4", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Result: 0.045454545454545456\n" + ] + } + ], + "source": [ + "try:\n", + " a = int(input(\"Enter first value: \"))\n", + " b = int(input(\"Enter second value: \"))\n", + " \n", + " result = a / b\n", + " print(\"Result:\", result)\n", + "\n", + "except:\n", + " print(\"Error occurred during calculation\")" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "9cebb24f", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Result: 0.5\n" + ] + } + ], + "source": [ + "try:\n", + " a = int(input(\"Enter first number: \"))\n", + " b = int(input(\"Enter second number: \"))\n", + " \n", + " print(\"Result:\", a / b)\n", + "\n", + "except ValueError:\n", + " print(\"Invalid number entered\")\n", + "\n", + "except ZeroDivisionError:\n", + " print(\"Division by zero is not allowed\")" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "3ec6b04f", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Result: 0.8\n" + ] + } + ], + "source": [ + "try:\n", + " a = int(input(\"Enter first number: \"))\n", + " b = int(input(\"Enter second number: \"))\n", + " \n", + " result = a / b\n", + " print(\"Result:\", result)\n", + "\n", + "except ValueError:\n", + " print(\"Invalid input! Please enter numbers.\")\n", + "\n", + "except ZeroDivisionError:\n", + " print(\"Error! Division by zero.\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c2e2606c", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "pyt101 (3.13.12)", + "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.12" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/tasks/python_11-3-26.ipynb b/tasks/python_11-3-26.ipynb new file mode 100644 index 0000000..650733a --- /dev/null +++ b/tasks/python_11-3-26.ipynb @@ -0,0 +1,212 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 2, + "id": "45f0d2b5", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[3, 6, 9]\n" + ] + } + ], + "source": [ + "multiples_of_3 = [i for i in range(1, 11) if i % 3 == 0]\n", + "# multiples_of_3 =6\n", + "print(multiples_of_3)" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "a039f837", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[78, 85, 90, 67, 88, 92, 74, 81, 69, 95]\n" + ] + } + ], + "source": [ + "scores = [78, 85, 90, 67, 88, 92, 74, 81, 69, 95,\n", + " 73, 84, 77, 91, 68, 86, 79, 82, 76, 89]\n", + "\n", + "first_10_scores = scores[:10]\n", + "\n", + "print(first_10_scores)" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "d4c1c5c4", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[86, 79, 82, 76, 89]\n" + ] + } + ], + "source": [ + "scores = [78, 85, 90, 67, 88, 92, 74, 81, 69, 95,\n", + " 73, 84, 77, 91, 68, 86, 79, 82, 76, 89]\n", + "\n", + "last_5_scores = scores[-5:]\n", + "\n", + "print(last_5_scores)" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "d1d5096c", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "First 10 scores: [78, 40, 92, 34, 67, 88, 53, 41, 76, 29]\n", + "Last 5 scores: [90, 47, 68, 33, 84]\n", + "Every second score: [78, 92, 67, 53, 76, 64, 39, 72, 47, 33]\n" + ] + } + ], + "source": [ + "# List of scores\n", + "scores = [78, 40, 92, 34, 67, 88, 53, 41, 76, 29, 64, 81, 39, 55, 72, 90, 47, 68, 33, 84]\n", + "\n", + "# 2. Slicing\n", + "first_10 = scores[:10]\n", + "last_5 = scores[-5:]\n", + "every_second = scores[::2]\n", + "\n", + "print(\"First 10 scores:\", first_10)\n", + "print(\"Last 5 scores:\", last_5)\n", + "print(\"Every second score:\", every_second)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "07c2d723", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "Student Results:\n", + "78 - Passed\n", + "40 - Passed\n", + "92 - Passed\n", + "34 - Failed\n", + "67 - Passed\n", + "88 - Passed\n", + "53 - Passed\n", + "41 - Passed\n", + "76 - Passed\n", + "29 - Failed\n", + "64 - Passed\n", + "81 - Passed\n", + "39 - Failed\n", + "55 - Passed\n", + "72 - Passed\n", + "90 - Passed\n", + "47 - Passed\n", + "68 - Passed\n", + "33 - Failed\n", + "84 - Passed\n" + ] + } + ], + "source": [ + "# 3. Iteration (Pass / Fail)\n", + "print(\"\\nStudent Results:\")\n", + "for score in scores:\n", + " if score >= 40:\n", + " print(score, \"- Passed\")\n", + " else:\n", + " print(score, \"- Failed\")" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "f102c45c", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "Passing scores: [78, 40, 92, 67, 88, 53, 41, 76, 64, 81, 55, 72, 90, 47, 68, 84]\n", + "Scores with +5 bonus: [83, 45, 97, 39, 72, 93, 58, 46, 81, 34, 69, 86, 44, 60, 77, 95, 52, 73, 38, 89]\n", + "Scores greater than 75: [78, 92, 88, 76, 81, 90, 84]\n", + "\n", + "Number of students passed: 16\n", + "Number of students failed: 4\n" + ] + } + ], + "source": [ + "# 4. List Comprehension\n", + "passing_scores = [s for s in scores if s >= 40]\n", + "bonus_scores = [s + 5 for s in scores]\n", + "scores_above_75 = [s for s in scores if s > 75]\n", + "\n", + "print(\"\\nPassing scores:\", passing_scores)\n", + "print(\"Scores with +5 bonus:\", bonus_scores)\n", + "print(\"Scores greater than 75:\", scores_above_75)\n", + "\n", + "# 5. Count pass and fail\n", + "pass_count = len([s for s in scores if s >= 40])\n", + "fail_count = len([s for s in scores if s < 40])\n", + "\n", + "print(\"\\nNumber of students passed:\", pass_count)\n", + "print(\"Number of students failed:\", fail_count)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d9c393de", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "pyt101 (3.13.12)", + "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.12" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} From 0fe984bc3ed4d1b84f3559e48be8691c2264a142 Mon Sep 17 00:00:00 2001 From: KanakC2 Date: Wed, 11 Mar 2026 16:56:27 +0530 Subject: [PATCH 3/3] tasks for 11 March 2026 --- tasks/python_10-3-26.ipynb => python_10-3-26.ipynb | 0 tasks/python_11-3-26.ipynb => python_11-3-26.ipynb | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename tasks/python_10-3-26.ipynb => python_10-3-26.ipynb (100%) rename tasks/python_11-3-26.ipynb => python_11-3-26.ipynb (100%) diff --git a/tasks/python_10-3-26.ipynb b/python_10-3-26.ipynb similarity index 100% rename from tasks/python_10-3-26.ipynb rename to python_10-3-26.ipynb diff --git a/tasks/python_11-3-26.ipynb b/python_11-3-26.ipynb similarity index 100% rename from tasks/python_11-3-26.ipynb rename to python_11-3-26.ipynb