From 6dd0d6fb9e48f8e81453887c315d45f1e4b32a0b Mon Sep 17 00:00:00 2001 From: syedabdullahbukhari77 Date: Tue, 19 Aug 2025 22:28:51 +0500 Subject: [PATCH 1/3] [--updt: Add Excercises/Python Session Fundamentals/Python Session 01 - Notebook] --- .../Python Session - 01/Python Session - 01.ipynb | 1 + 1 file changed, 1 insertion(+) create mode 100644 Excercises/Python Sessions Fundamentals/Python Session - 01/Python Session - 01.ipynb diff --git a/Excercises/Python Sessions Fundamentals/Python Session - 01/Python Session - 01.ipynb b/Excercises/Python Sessions Fundamentals/Python Session - 01/Python Session - 01.ipynb new file mode 100644 index 0000000..f95b62e --- /dev/null +++ b/Excercises/Python Sessions Fundamentals/Python Session - 01/Python Session - 01.ipynb @@ -0,0 +1 @@ +{"nbformat":4,"nbformat_minor":0,"metadata":{"colab":{"provenance":[],"authorship_tag":"ABX9TyMAQwk5Up4/TfwCoyql3Z8P"},"kernelspec":{"name":"python3","display_name":"Python 3"},"language_info":{"name":"python"}},"cells":[{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"9etUWLtkGTe6","executionInfo":{"status":"ok","timestamp":1755620011945,"user_tz":-300,"elapsed":16,"user":{"displayName":"Syed Abdullah Bukhari (Imam)","userId":"18410448924632905759"}},"outputId":"7c7bae76-f021-425d-df2c-538b9448bd36"},"outputs":[{"output_type":"stream","name":"stdout","text":["Not Prime\n"]}],"source":["number = 8\n","\n","is_prime = None\n","\n","if number <= 1: is_prime = False\n","else:\n"," for i in range(2, number):\n"," if number% i == 0: is_prime = False\n"," break\n","\n","print('Prime' if is_prime else\n"," 'Not Prime')"]},{"cell_type":"code","source":["number = 100\n","\n","is_prime = None\n","\n","if number <= 1: is_prime = False\n","\n","else:\n"," for i in range(2 , number):\n"," if number % i == 0:\n"," is_prime = True\n"," break\n","\n","if is_prime: print('Prime')\n","else: print('Not Prime')"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"bahq1X66Guyt","executionInfo":{"status":"ok","timestamp":1755620198793,"user_tz":-300,"elapsed":52,"user":{"displayName":"Syed Abdullah Bukhari (Imam)","userId":"18410448924632905759"}},"outputId":"fd3b70aa-b863-43d9-f1d2-e398647969a9"},"execution_count":null,"outputs":[{"output_type":"stream","name":"stdout","text":["Prime\n"]}]},{"cell_type":"code","source":["reversed_characters = ''"],"metadata":{"id":"kW-zTTrIHZpf"},"execution_count":null,"outputs":[]},{"cell_type":"code","source":["text: str = 'California'"],"metadata":{"id":"LZtre2BkH3BO"},"execution_count":null,"outputs":[]},{"cell_type":"code","source":["for element in text:\n"," reversed_characters = element + reversed_characters\n","print(reversed_characters)"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"-h8U7HvRH95e","executionInfo":{"status":"ok","timestamp":1755620353659,"user_tz":-300,"elapsed":19,"user":{"displayName":"Syed Abdullah Bukhari (Imam)","userId":"18410448924632905759"}},"outputId":"c05ae7e4-8cfa-458f-e8e4-6e23a3de8421"},"execution_count":null,"outputs":[{"output_type":"stream","name":"stdout","text":["ainrofilaC\n"]}]},{"cell_type":"code","source":["numbers = [4, 1, 9, 3, 7]\n","max_numbers = numbers[0]"],"metadata":{"id":"pHKQ9e1FIFuH","executionInfo":{"status":"ok","timestamp":1755621810571,"user_tz":-300,"elapsed":5,"user":{"displayName":"Syed Abdullah Bukhari (Imam)","userId":"18410448924632905759"}}},"execution_count":15,"outputs":[]},{"cell_type":"code","source":["for num in numbers:\n"," if num > max_numbers :\n"," max_numbers = num\n","\n","print(f'max: is {max_numbers}')"],"metadata":{"id":"SY8Z_rCSMEXS","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1755621816794,"user_tz":-300,"elapsed":7,"user":{"displayName":"Syed Abdullah Bukhari (Imam)","userId":"18410448924632905759"}},"outputId":"14b81e75-2c7d-4ca7-dd43-7f767268c7f2"},"execution_count":16,"outputs":[{"output_type":"stream","name":"stdout","text":["max: is 9\n"]}]},{"cell_type":"code","source":["for i in range(1,10):\n"," if i % 2 == 0: print('Is Even')\n"," else: print('Is Odd')"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"Ocm0va5aNf1s","executionInfo":{"status":"ok","timestamp":1755621862871,"user_tz":-300,"elapsed":27,"user":{"displayName":"Syed Abdullah Bukhari (Imam)","userId":"18410448924632905759"}},"outputId":"ccc92366-9afd-47c4-90ce-2fb94ca01dd9"},"execution_count":17,"outputs":[{"output_type":"stream","name":"stdout","text":["Is Odd\n","Is Even\n","Is Odd\n","Is Even\n","Is Odd\n","Is Even\n","Is Odd\n","Is Even\n","Is Odd\n"]}]},{"cell_type":"code","source":["for i in range(1 , 11):\n"," if i % 1 == 0:\n"," odd_numbers = i\n","\n"," print(odd_numbers)"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"q-kM3BFoN6xN","executionInfo":{"status":"ok","timestamp":1755621980608,"user_tz":-300,"elapsed":8,"user":{"displayName":"Syed Abdullah Bukhari (Imam)","userId":"18410448924632905759"}},"outputId":"77c184f6-4106-40ef-f404-43706fd4fbc8"},"execution_count":20,"outputs":[{"output_type":"stream","name":"stdout","text":["1\n","2\n","3\n","4\n","5\n","6\n","7\n","8\n","9\n","10\n"]}]},{"cell_type":"code","source":["for i in range(1, 11):\n"," if i % 2 == 0:\n"," even = i\n","\n","print(even)"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"xtRykgPXPQ1q","executionInfo":{"status":"ok","timestamp":1755622326128,"user_tz":-300,"elapsed":7,"user":{"displayName":"Syed Abdullah Bukhari (Imam)","userId":"18410448924632905759"}},"outputId":"3a68806a-4d67-4e27-b27a-6c10e1a34349"},"execution_count":24,"outputs":[{"output_type":"stream","name":"stdout","text":["10\n"]}]},{"cell_type":"code","source":["numbers : list = []\n","\n","for i in range(1, 6):\n"," numbers.append(i)\n","\n","print( numbers)"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"9LCxLQVrSgel","executionInfo":{"status":"ok","timestamp":1755623345566,"user_tz":-300,"elapsed":51,"user":{"displayName":"Syed Abdullah Bukhari (Imam)","userId":"18410448924632905759"}},"outputId":"72d0c47e-4284-47e0-f47d-50efcc8e4493"},"execution_count":43,"outputs":[{"output_type":"stream","name":"stdout","text":["[1, 2, 3, 4, 5]\n"]}]},{"cell_type":"code","source":["for n in numbers:\n"," if n % 2 != 0:\n"," odd_n = n\n"," break\n","\n","print(f'Odd number : {odd_n}')"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"fux9ysgaOVBC","executionInfo":{"status":"ok","timestamp":1755623178092,"user_tz":-300,"elapsed":7,"user":{"displayName":"Syed Abdullah Bukhari (Imam)","userId":"18410448924632905759"}},"outputId":"50f2cd89-eec7-4797-c1ce-afecc46afaaf"},"execution_count":33,"outputs":[{"output_type":"stream","name":"stdout","text":["Odd number : 1\n"]}]},{"cell_type":"code","source":["print('Odd number : {odd_n}')"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"xcSf4cO2SEgJ","executionInfo":{"status":"ok","timestamp":1755623155198,"user_tz":-300,"elapsed":7,"user":{"displayName":"Syed Abdullah Bukhari (Imam)","userId":"18410448924632905759"}},"outputId":"d77c6b91-b7d1-4fa0-d542-6cec75a092e6"},"execution_count":32,"outputs":[{"output_type":"stream","name":"stdout","text":["Odd number : {odd_n}\n"]}]},{"cell_type":"code","source":["numbers"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"R2D7aTB1S2Sp","executionInfo":{"status":"ok","timestamp":1755623404590,"user_tz":-300,"elapsed":9,"user":{"displayName":"Syed Abdullah Bukhari (Imam)","userId":"18410448924632905759"}},"outputId":"b42f83f0-b80d-4b52-cd57-12332b0b6656"},"execution_count":44,"outputs":[{"output_type":"execute_result","data":{"text/plain":["[1, 2, 3, 4, 5]"]},"metadata":{},"execution_count":44}]},{"cell_type":"code","source":["new_list = []\n","\n","for i in numbers:\n"," new_list.append(i**i)\n","\n","print(new_list)"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"1Fg9BcDvTzLH","executionInfo":{"status":"ok","timestamp":1755623569363,"user_tz":-300,"elapsed":37,"user":{"displayName":"Syed Abdullah Bukhari (Imam)","userId":"18410448924632905759"}},"outputId":"2cb9de78-4394-483b-cc14-badf8163f31d"},"execution_count":52,"outputs":[{"output_type":"stream","name":"stdout","text":["[1, 4, 27, 256, 3125]\n"]}]},{"cell_type":"code","source":["new_list = [(i**2) for i in numbers]\n","new_list"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"WxG_23xAUANd","executionInfo":{"status":"ok","timestamp":1755623633034,"user_tz":-300,"elapsed":7,"user":{"displayName":"Syed Abdullah Bukhari (Imam)","userId":"18410448924632905759"}},"outputId":"37e5531b-7090-4ab3-b2e8-8b3bf621104c"},"execution_count":57,"outputs":[{"output_type":"execute_result","data":{"text/plain":["[1, 4, 9, 16, 25]"]},"metadata":{},"execution_count":57}]},{"cell_type":"code","source":["def reverse_string(text:str):\n"," return text[::-1]\n","\n","print(reverse_string('Ali'))\n","print(reverse_string('Ammar'))"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"tNqBJ11MUlzM","executionInfo":{"status":"ok","timestamp":1755623779004,"user_tz":-300,"elapsed":26,"user":{"displayName":"Syed Abdullah Bukhari (Imam)","userId":"18410448924632905759"}},"outputId":"ffbfed4f-093b-4c5a-d3ea-f5cefa50c140"},"execution_count":60,"outputs":[{"output_type":"stream","name":"stdout","text":["ilA\n","rammA\n"]}]},{"cell_type":"code","source":["def count_vowels(text:str):\n"," vowels = 'aeiou'\n"," return sum(1 for char in text.lower() if char in vowels)"],"metadata":{"id":"a8cCdAfWVJ5u","executionInfo":{"status":"ok","timestamp":1755623887657,"user_tz":-300,"elapsed":7,"user":{"displayName":"Syed Abdullah Bukhari (Imam)","userId":"18410448924632905759"}}},"execution_count":62,"outputs":[]},{"cell_type":"code","source":["count_vowels('Abu Bakr')"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"jghO-dV-VkrB","executionInfo":{"status":"ok","timestamp":1755623898906,"user_tz":-300,"elapsed":7,"user":{"displayName":"Syed Abdullah Bukhari (Imam)","userId":"18410448924632905759"}},"outputId":"befee6c6-e348-45b2-af7d-5c7599405e42"},"execution_count":63,"outputs":[{"output_type":"execute_result","data":{"text/plain":["3"]},"metadata":{},"execution_count":63}]},{"cell_type":"code","source":["count_vowels('Abbas')"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"L6fsQyLlVr3K","executionInfo":{"status":"ok","timestamp":1755623966297,"user_tz":-300,"elapsed":12,"user":{"displayName":"Syed Abdullah Bukhari (Imam)","userId":"18410448924632905759"}},"outputId":"25043a7e-9641-4892-89fd-0abfd3efc685"},"execution_count":72,"outputs":[{"output_type":"execute_result","data":{"text/plain":["2"]},"metadata":{},"execution_count":72}]},{"cell_type":"code","source":["count_vowels('Omer')"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"EpNRF9RlVtLD","executionInfo":{"status":"ok","timestamp":1755623974514,"user_tz":-300,"elapsed":54,"user":{"displayName":"Syed Abdullah Bukhari (Imam)","userId":"18410448924632905759"}},"outputId":"00685303-db5e-4867-c215-42603ee7cb10"},"execution_count":73,"outputs":[{"output_type":"execute_result","data":{"text/plain":["2"]},"metadata":{},"execution_count":73}]},{"cell_type":"code","source":[],"metadata":{"id":"PFu_pbyXVwPq"},"execution_count":null,"outputs":[]}]} \ No newline at end of file From 68268117582c919e7aba2bf864489ec2af7e3ba6 Mon Sep 17 00:00:00 2001 From: syedabdullahbukhari77 Date: Tue, 19 Aug 2025 22:37:09 +0500 Subject: [PATCH 2/3] [--update: Rename folder & files for better readabilty] --- .../Python Session - 01/Python Session - 01.ipynb | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {Excercises => Python Excercises Logic Building}/Python Sessions Fundamentals/Python Session - 01/Python Session - 01.ipynb (100%) diff --git a/Excercises/Python Sessions Fundamentals/Python Session - 01/Python Session - 01.ipynb b/Python Excercises Logic Building/Python Sessions Fundamentals/Python Session - 01/Python Session - 01.ipynb similarity index 100% rename from Excercises/Python Sessions Fundamentals/Python Session - 01/Python Session - 01.ipynb rename to Python Excercises Logic Building/Python Sessions Fundamentals/Python Session - 01/Python Session - 01.ipynb From 93bd724f01f018062ba581024b208844b7c5a7bc Mon Sep 17 00:00:00 2001 From: syedabdullahbukhari77 Date: Wed, 20 Aug 2025 23:28:09 +0500 Subject: [PATCH 3/3] [--update: Add Excercises/Python Session Fundamentals/Python Session 02] --- .../Python Session - 01.ipynb | 0 .../Python_Session_02.ipynb | 337 ++++++++++++++++++ 2 files changed, 337 insertions(+) rename {Python Excercises Logic Building => Logic Building Exercises}/Python Sessions Fundamentals/Python Session - 01/Python Session - 01.ipynb (100%) create mode 100644 Logic Building Exercises/Python Sessions Fundamentals/Python Session - 02/Python_Session_02.ipynb diff --git a/Python Excercises Logic Building/Python Sessions Fundamentals/Python Session - 01/Python Session - 01.ipynb b/Logic Building Exercises/Python Sessions Fundamentals/Python Session - 01/Python Session - 01.ipynb similarity index 100% rename from Python Excercises Logic Building/Python Sessions Fundamentals/Python Session - 01/Python Session - 01.ipynb rename to Logic Building Exercises/Python Sessions Fundamentals/Python Session - 01/Python Session - 01.ipynb diff --git a/Logic Building Exercises/Python Sessions Fundamentals/Python Session - 02/Python_Session_02.ipynb b/Logic Building Exercises/Python Sessions Fundamentals/Python Session - 02/Python_Session_02.ipynb new file mode 100644 index 0000000..cc03146 --- /dev/null +++ b/Logic Building Exercises/Python Sessions Fundamentals/Python Session - 02/Python_Session_02.ipynb @@ -0,0 +1,337 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "provenance": [] + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + } + }, + "cells": [ + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "id": "Acnj71h-cJ6q", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "b7e6ef72-4462-44b1-ef84-075b21bad469" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "False\n", + "True\n", + "False\n", + "True\n", + "False\n", + "True\n" + ] + } + ], + "source": [ + "numbers: list = [print(n % 2 != 0) for n in range(0,6)]" + ] + }, + { + "cell_type": "code", + "source": [ + "print(numbers)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "j00c1ru7OrIv", + "outputId": "0736482b-1f00-465d-fcc3-75dcb3e66ed9" + }, + "execution_count": 2, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "[None, None, None, None, None]\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "# odd_n = []" + ], + "metadata": { + "id": "m2AnhkqQPI3V" + }, + "execution_count": 15, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "# for n in range(1, 6):\n", + "# if n % 2 != 0:\n", + "# odd_n.append(n)\n", + "# else:\n", + "# even_numbers = [n]\n", + "\n", + "# print(odd_n)\n", + "# print(even_numbers)" + ], + "metadata": { + "id": "sfljUxooOtrD" + }, + "execution_count": 14, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "odd_n: list = []\n", + "\n", + "for n in range(1, 6):\n", + " if n % 2 != 0: odd_n.append(n)\n", + "\n", + "print(odd_n)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "rCsrPngROx4Q", + "outputId": "a84a372a-1320-48a1-b6d2-4d90f8fc532b" + }, + "execution_count": 18, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "[1, 3, 5]\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [], + "metadata": { + "id": "EBHH5k93pz4f" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "for n in range(0 , 1):\n", + " if n % 2 == 0:\n", + " print('Is Even')\n", + " else: print('Is odd')\n", + "" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "ghpUWAWgPlNN", + "outputId": "d6af0657-d84f-43b5-f468-02ff690f3f85" + }, + "execution_count": 19, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Is Even\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "def check_even_odd() -> int:\n", + " for n in range(0, 1):\n", + " 'Is Even' if n % 2 ==0 else 'Is Odd'" + ], + "metadata": { + "id": "4C0NObxxp5I7" + }, + "execution_count": 21, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "def check_even_odd(x: int , y: int) -> str:\n", + " return 'Is Even' if (x & y % 2 == 0) else 'Is Odd'" + ], + "metadata": { + "id": "kC5oH5-lqobx" + }, + "execution_count": 23, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "print(check_even_odd(12 , 2))\n", + "print(check_even_odd(34 , 21))\n", + "print(check_even_odd(21 , 45))" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "75RMtnROq_jh", + "outputId": "df91ba05-eb3f-4e98-ddc5-c9b5255c7be6" + }, + "execution_count": 29, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Is Even\n", + "Is Even\n", + "Is Odd\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "def check_even_n(start: int , end: int) -> None:\n", + " for num in range(start , end + 1):\n", + " if num % 2 == 0:\n", + " print(f' Is Even: {num}')\n", + " else: print(f'Is odd: {num}')\n", + "\n", + "print(check_even_n(3 , 21))" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "N8HEjoV3rBsG", + "outputId": "f6e24bc6-885a-49bf-d052-5832343dce68" + }, + "execution_count": 33, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Is odd: 3\n", + " Is Even: 4\n", + "Is odd: 5\n", + " Is Even: 6\n", + "Is odd: 7\n", + " Is Even: 8\n", + "Is odd: 9\n", + " Is Even: 10\n", + "Is odd: 11\n", + " Is Even: 12\n", + "Is odd: 13\n", + " Is Even: 14\n", + "Is odd: 15\n", + " Is Even: 16\n", + "Is odd: 17\n", + " Is Even: 18\n", + "Is odd: 19\n", + " Is Even: 20\n", + "Is odd: 21\n", + "None\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "def check_even_n(start: int , end: int) -> None:\n", + " return [f'is Even {num}' if num % 2 == 0 else f'Is Odd: {num}' for num in range(start , end + 1)]\n", + "\n", + "print(check_even_n(1 , 21))" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "tI7XdjoGrwXC", + "outputId": "06f42567-5db4-4425-9ad2-e0ec5ab2e87e" + }, + "execution_count": 40, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "['Is Odd: 1', 'is Even 2', 'Is Odd: 3', 'is Even 4', 'Is Odd: 5', 'is Even 6', 'Is Odd: 7', 'is Even 8', 'Is Odd: 9', 'is Even 10', 'Is Odd: 11', 'is Even 12', 'Is Odd: 13', 'is Even 14', 'Is Odd: 15', 'is Even 16', 'Is Odd: 17', 'is Even 18', 'Is Odd: 19', 'is Even 20', 'Is Odd: 21']\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "result = check_even_n(3, 17)\n", + "\n", + "for i in result:\n", + " print(i)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "dv9RXbFcsKMt", + "outputId": "3ca9b051-0f41-40f6-9d61-2846da1f82a9" + }, + "execution_count": 42, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Is Odd: 3\n", + "is Even 4\n", + "Is Odd: 5\n", + "is Even 6\n", + "Is Odd: 7\n", + "is Even 8\n", + "Is Odd: 9\n", + "is Even 10\n", + "Is Odd: 11\n", + "is Even 12\n", + "Is Odd: 13\n", + "is Even 14\n", + "Is Odd: 15\n", + "is Even 16\n", + "Is Odd: 17\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [], + "metadata": { + "id": "rEXmyQ4otUzj" + }, + "execution_count": null, + "outputs": [] + } + ] +} \ No newline at end of file