From 5741e342ce2abc4cdcaae9792662fa0c6e045e01 Mon Sep 17 00:00:00 2001 From: ritik ramuka Date: Tue, 8 Feb 2022 16:17:18 +0530 Subject: [PATCH 01/41] Initial commit --- Python/README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 Python/README.md diff --git a/Python/README.md b/Python/README.md new file mode 100644 index 0000000..511eff2 --- /dev/null +++ b/Python/README.md @@ -0,0 +1 @@ +# Python Course Outline \ No newline at end of file From 1257237c3203d5a67adea2212419178ae59f5951 Mon Sep 17 00:00:00 2001 From: Ritik Ramuka <56073559+ritikramuka@users.noreply.github.com> Date: Tue, 8 Feb 2022 16:35:20 +0530 Subject: [PATCH 02/41] TypesOfVariables-Code --- TypesOfVariables_English.ipynb | 253 +++++++++++++++++++++++++++++++++ 1 file changed, 253 insertions(+) create mode 100644 TypesOfVariables_English.ipynb diff --git a/TypesOfVariables_English.ipynb b/TypesOfVariables_English.ipynb new file mode 100644 index 0000000..4e4b98c --- /dev/null +++ b/TypesOfVariables_English.ipynb @@ -0,0 +1,253 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "name": "TypesOfVariables_English.ipynb", + "provenance": [], + "authorship_tag": "ABX9TyNFaIr8gWQVDvv4ecRvnZx0", + "include_colab_link": true + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + } + }, + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "view-in-github", + "colab_type": "text" + }, + "source": [ + "\"Open" + ] + }, + { + "cell_type": "markdown", + "source": [ + "Python has no command to declare variables\n" + ], + "metadata": { + "id": "GA1qS6Fs_S9H" + } + }, + { + "cell_type": "code", + "source": [ + "num = 10" + ], + "metadata": { + "id": "9ym43OUP_Z9V" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "string = 'Pepcoding'" + ], + "metadata": { + "id": "sq_DvzPd_jZv" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "flt = 2.3" + ], + "metadata": { + "id": "ifPN60_a_mPL" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "#case sensitive \n", + "\n", + "Flt = 3.3\n", + "print(flt)\n", + "print(Flt)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "CyGFsGFd_ny7", + "outputId": "41d3315f-c862-49ee-c07b-1f49b93610ca" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "2.3\n", + "3.3\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(type(num))" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "X6q--RW2AFDf", + "outputId": "febd1247-5bac-434e-e32f-59b705d6c054" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(type(string), type(flt))" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "aO4tEdaPAI7g", + "outputId": "f22bd971-92dc-4c69-acf5-79fe8353d5a4" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + " \n" + ] + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "* A variable name must start with a letter or the underscore character\n", + "* A variable name cannot start with a number\n", + "* A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ )\n", + "* Variable names are case-sensitive (age, Age and AGE are three different variables)" + ], + "metadata": { + "id": "EJCHVKJXAV85" + } + }, + { + "cell_type": "code", + "source": [ + "#some legal variables names\n", + "\n", + "pepcoding = \"pep\"\n", + "pep9coding = \"pep\"\n", + "_pepcoding = \"pep\"\n", + "pepcoding1 = \"pep\"\n", + "_pep_coding = \"pep\"\n", + "PEPcoding = \"pep\"" + ], + "metadata": { + "id": "lEUNJ92jAhR-" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "#some illegal variables names\n", + "\n", + "pep-coding = \"pep\"\n", + "9pepcoding = \"pep\"" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 125 + }, + "id": "ewLjYfQmBLLo", + "outputId": "213890fe-27b7-4616-d030-6bfb324ed699" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "error", + "ename": "SyntaxError", + "evalue": "ignored", + "traceback": [ + "\u001b[0;36m File \u001b[0;32m\"\"\u001b[0;36m, line \u001b[0;32m4\u001b[0m\n\u001b[0;31m 9pepcoding = \"pep\"\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "a,b,c = 10,20,30\n", + "print(a, b, c)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "6e3CGOFcBhn_", + "outputId": "7b042307-621d-4f24-cff2-b21804433f11" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "10 20 30\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "a=b=c=50\n", + "print(a,b,c)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "7j4tJlDUBrWy", + "outputId": "ff470b12-c633-47ed-e663-61384ae5a895" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "50 50 50\n" + ] + } + ] + } + ] +} \ No newline at end of file From f76e68767665c5f40c830726ae10d1a26dbc7f0f Mon Sep 17 00:00:00 2001 From: Ritik Ramuka <56073559+ritikramuka@users.noreply.github.com> Date: Tue, 8 Feb 2022 16:52:25 +0530 Subject: [PATCH 03/41] Operators in Python Code --- Operators_English.ipynb | 490 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 490 insertions(+) create mode 100644 Operators_English.ipynb diff --git a/Operators_English.ipynb b/Operators_English.ipynb new file mode 100644 index 0000000..56be15c --- /dev/null +++ b/Operators_English.ipynb @@ -0,0 +1,490 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "name": "Operators_English.ipynb", + "provenance": [], + "authorship_tag": "ABX9TyPM6DeUwALjm2xngi2hOHbZ", + "include_colab_link": true + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + } + }, + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "view-in-github", + "colab_type": "text" + }, + "source": [ + "\"Open" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "QLllOyxIyc_z", + "outputId": "81ab843e-eb8a-494f-ca76-b437e6318a0e" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "30\n" + ] + } + ], + "source": [ + "# Arithmetic\n", + "\n", + "a = 10\n", + "b = 20\n", + "print(a + b)" + ] + }, + { + "cell_type": "code", + "source": [ + "print(a / b)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "4QMMLEDr080V", + "outputId": "8cd2333b-38bc-4c21-ea87-c01ab0624019" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "0.5\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(a % b)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "hNpvBVYX0-xy", + "outputId": "4733ef33-6527-480f-87af-aacc289d3e49" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "10\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(10 ** a)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "xKPhZfmi1A72", + "outputId": "89d9901e-1920-479e-b024-d97db21bf422" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "10000000000\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(a // b)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "Y-QzP6_G1JXm", + "outputId": "350443eb-ac8e-46b4-9784-b8dc4f6983b5" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "0\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "# Assignment Operator\n", + "\n", + "a = 10" + ], + "metadata": { + "id": "yxuuOP7s1adE" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "b += a" + ], + "metadata": { + "id": "6QfGed2R1nti" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "print(a, b)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "cuGgYJFk1oqf", + "outputId": "616b1e86-2c8c-471e-bcea-2a3cabc0f8cd" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "10 30\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "a **= 10" + ], + "metadata": { + "id": "KJQ8sjtc1rNg" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "print(a)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "I5Hn6L0D1wlq", + "outputId": "fa662f26-6ac6-49b2-ccd4-7dd033f6c60e" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "10000000000\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "# Comparison Operator\n", + "\n", + "print(a == b)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "hKxBY4Gx1x54", + "outputId": "9182f635-f2ca-4dae-ebb3-8b4836eed833" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "False\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(a > b)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "ly80xlNG1908", + "outputId": "65b0ee5a-c41d-4452-9e45-f410562cfb40" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "True\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(a != b)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "dIlI197r2iOj", + "outputId": "73ced0eb-d87a-4ee5-e5e3-58d53f3806ef" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "True\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "# more are: \">\" \"<\" \">=\" \"<=\" \"!=\"" + ], + "metadata": { + "id": "wea9jfQU2mcV" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "# Logical Operators\n", + "\n", + "# like: and, or, not\n", + "a = \"pepcoding\"\n", + "b = \"Namaste\"\n", + "print(a == \"pepcoding\" and b == \"Namaste\")" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "CyyhzYp_2ykE", + "outputId": "eb91b269-c853-4bbb-8043-740412f96b13" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "True\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(a == \"pp\" and b == \"Namaste\")" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "P2o_aASo3MJ-", + "outputId": "c23782f4-7199-493f-b08b-f3b05efc43f0" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "False\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(a == \"pepcoding\" and b == \"Nan\")" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "WtXA25Xq3QTC", + "outputId": "1b643015-983f-4884-b247-37847aee3541" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "False\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(a == \"pepcoding\" or b == \"Namaste\")" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "NmirGMJF3UZh", + "outputId": "7086529d-d2ae-466c-d9b8-108e11aa4399" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "True\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(a == \"pp\" or b == \"Namaste\")" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "hhRT85kL3YeN", + "outputId": "6f6af50c-883c-4315-f11d-2872d7b94fc0" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "True\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(a == \"pepcoding\" or b == \"Nan\")" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "yTuHRGKH3abI", + "outputId": "776dc1d2-4583-4351-9079-563c4730363b" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "True\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(not(a == \"pepcoding\" and b == \"Nan\"))" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "1fpArzks3cZu", + "outputId": "143bf6a6-8612-44c1-ba23-23d065dd6afb" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "True\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "" + ], + "metadata": { + "id": "2Ss3iNoV3jQP" + }, + "execution_count": null, + "outputs": [] + } + ] +} \ No newline at end of file From 46a4d0ac50980c32f3a27d4f42325870079bd3ef Mon Sep 17 00:00:00 2001 From: Ritik Ramuka <56073559+ritikramuka@users.noreply.github.com> Date: Tue, 8 Feb 2022 16:54:24 +0530 Subject: [PATCH 04/41] I/O in Python Code --- I_O_Python_English.ipynb | 249 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 249 insertions(+) create mode 100644 I_O_Python_English.ipynb diff --git a/I_O_Python_English.ipynb b/I_O_Python_English.ipynb new file mode 100644 index 0000000..1f0ea60 --- /dev/null +++ b/I_O_Python_English.ipynb @@ -0,0 +1,249 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "name": "I/O-Python_English.ipynb", + "provenance": [], + "authorship_tag": "ABX9TyNt3EooRyqbi/+rCRg+LcFu", + "include_colab_link": true + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + } + }, + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "view-in-github", + "colab_type": "text" + }, + "source": [ + "\"Open" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "z3PHK6CdMuWf", + "outputId": "a420514a-5fdf-4af2-e671-05b08470d477" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter your name: Ritik\n" + ] + } + ], + "source": [ + "name = input(\"Enter your name: \")" + ] + }, + { + "cell_type": "code", + "source": [ + "print(name)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "b7bWmsN0ShsU", + "outputId": "b62d9bc9-f17d-438d-d546-22e95acd8251" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Ritik\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(type(name))" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "Jcs9nIwpSoTA", + "outputId": "11893ba2-6f61-4098-e269-2412abbd38e8" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "age = input(\"Enter your age: \")" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "l_1KNhk4St8H", + "outputId": "24d8ff75-1feb-49f2-ea28-b88da3912e79" + }, + "execution_count": null, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter your age: 21\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(age, type(age))" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "dxDKKOr-S50E", + "outputId": "c13f132d-d90d-4ab4-977f-5bc7a475eb1d" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "21 \n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "age = int(input(\"Enter your age: \"))" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "QNGa6XvlS-OF", + "outputId": "d9450253-534c-4045-d1b3-6ea670de6167" + }, + "execution_count": null, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter your age: 21\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(age, type(age))" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "4dtUf2KxTExr", + "outputId": "bf9131f9-98d2-40af-f92a-53a806e10dd1" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "21 \n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "salary = float(input(\"Enter your salary: \"))" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "abysRY4uTJDK", + "outputId": "4b04904f-a872-4319-ceb3-2962261645ed" + }, + "execution_count": null, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter your salary: 29.9\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(type(salary))" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "Nb2lBgj7Thon", + "outputId": "21c63e3e-2e76-427c-8e03-2543ea7fa46d" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "" + ], + "metadata": { + "id": "VtJVoki0Tn-Y" + }, + "execution_count": null, + "outputs": [] + } + ] +} \ No newline at end of file From a68443b11086a56bfb7d6eabd9152d83cde2f8dc Mon Sep 17 00:00:00 2001 From: ritik ramuka Date: Tue, 8 Feb 2022 16:57:09 +0530 Subject: [PATCH 05/41] files at wrong directory removed --- I_O_Python_English.ipynb | 249 ----------------- Operators_English.ipynb | 490 --------------------------------- TypesOfVariables_English.ipynb | 253 ----------------- 3 files changed, 992 deletions(-) delete mode 100644 I_O_Python_English.ipynb delete mode 100644 Operators_English.ipynb delete mode 100644 TypesOfVariables_English.ipynb diff --git a/I_O_Python_English.ipynb b/I_O_Python_English.ipynb deleted file mode 100644 index 1f0ea60..0000000 --- a/I_O_Python_English.ipynb +++ /dev/null @@ -1,249 +0,0 @@ -{ - "nbformat": 4, - "nbformat_minor": 0, - "metadata": { - "colab": { - "name": "I/O-Python_English.ipynb", - "provenance": [], - "authorship_tag": "ABX9TyNt3EooRyqbi/+rCRg+LcFu", - "include_colab_link": true - }, - "kernelspec": { - "name": "python3", - "display_name": "Python 3" - }, - "language_info": { - "name": "python" - } - }, - "cells": [ - { - "cell_type": "markdown", - "metadata": { - "id": "view-in-github", - "colab_type": "text" - }, - "source": [ - "\"Open" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "z3PHK6CdMuWf", - "outputId": "a420514a-5fdf-4af2-e671-05b08470d477" - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Enter your name: Ritik\n" - ] - } - ], - "source": [ - "name = input(\"Enter your name: \")" - ] - }, - { - "cell_type": "code", - "source": [ - "print(name)" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "b7bWmsN0ShsU", - "outputId": "b62d9bc9-f17d-438d-d546-22e95acd8251" - }, - "execution_count": null, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "Ritik\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "print(type(name))" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "Jcs9nIwpSoTA", - "outputId": "11893ba2-6f61-4098-e269-2412abbd38e8" - }, - "execution_count": null, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "age = input(\"Enter your age: \")" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "l_1KNhk4St8H", - "outputId": "24d8ff75-1feb-49f2-ea28-b88da3912e79" - }, - "execution_count": null, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Enter your age: 21\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "print(age, type(age))" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "dxDKKOr-S50E", - "outputId": "c13f132d-d90d-4ab4-977f-5bc7a475eb1d" - }, - "execution_count": null, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "21 \n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "age = int(input(\"Enter your age: \"))" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "QNGa6XvlS-OF", - "outputId": "d9450253-534c-4045-d1b3-6ea670de6167" - }, - "execution_count": null, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Enter your age: 21\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "print(age, type(age))" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "4dtUf2KxTExr", - "outputId": "bf9131f9-98d2-40af-f92a-53a806e10dd1" - }, - "execution_count": null, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "21 \n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "salary = float(input(\"Enter your salary: \"))" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "abysRY4uTJDK", - "outputId": "4b04904f-a872-4319-ceb3-2962261645ed" - }, - "execution_count": null, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Enter your salary: 29.9\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "print(type(salary))" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "Nb2lBgj7Thon", - "outputId": "21c63e3e-2e76-427c-8e03-2543ea7fa46d" - }, - "execution_count": null, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "" - ], - "metadata": { - "id": "VtJVoki0Tn-Y" - }, - "execution_count": null, - "outputs": [] - } - ] -} \ No newline at end of file diff --git a/Operators_English.ipynb b/Operators_English.ipynb deleted file mode 100644 index 56be15c..0000000 --- a/Operators_English.ipynb +++ /dev/null @@ -1,490 +0,0 @@ -{ - "nbformat": 4, - "nbformat_minor": 0, - "metadata": { - "colab": { - "name": "Operators_English.ipynb", - "provenance": [], - "authorship_tag": "ABX9TyPM6DeUwALjm2xngi2hOHbZ", - "include_colab_link": true - }, - "kernelspec": { - "name": "python3", - "display_name": "Python 3" - }, - "language_info": { - "name": "python" - } - }, - "cells": [ - { - "cell_type": "markdown", - "metadata": { - "id": "view-in-github", - "colab_type": "text" - }, - "source": [ - "\"Open" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "QLllOyxIyc_z", - "outputId": "81ab843e-eb8a-494f-ca76-b437e6318a0e" - }, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "30\n" - ] - } - ], - "source": [ - "# Arithmetic\n", - "\n", - "a = 10\n", - "b = 20\n", - "print(a + b)" - ] - }, - { - "cell_type": "code", - "source": [ - "print(a / b)" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "4QMMLEDr080V", - "outputId": "8cd2333b-38bc-4c21-ea87-c01ab0624019" - }, - "execution_count": null, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "0.5\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "print(a % b)" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "hNpvBVYX0-xy", - "outputId": "4733ef33-6527-480f-87af-aacc289d3e49" - }, - "execution_count": null, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "10\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "print(10 ** a)" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "xKPhZfmi1A72", - "outputId": "89d9901e-1920-479e-b024-d97db21bf422" - }, - "execution_count": null, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "10000000000\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "print(a // b)" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "Y-QzP6_G1JXm", - "outputId": "350443eb-ac8e-46b4-9784-b8dc4f6983b5" - }, - "execution_count": null, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "0\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "# Assignment Operator\n", - "\n", - "a = 10" - ], - "metadata": { - "id": "yxuuOP7s1adE" - }, - "execution_count": null, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "b += a" - ], - "metadata": { - "id": "6QfGed2R1nti" - }, - "execution_count": null, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "print(a, b)" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "cuGgYJFk1oqf", - "outputId": "616b1e86-2c8c-471e-bcea-2a3cabc0f8cd" - }, - "execution_count": null, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "10 30\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "a **= 10" - ], - "metadata": { - "id": "KJQ8sjtc1rNg" - }, - "execution_count": null, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "print(a)" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "I5Hn6L0D1wlq", - "outputId": "fa662f26-6ac6-49b2-ccd4-7dd033f6c60e" - }, - "execution_count": null, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "10000000000\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "# Comparison Operator\n", - "\n", - "print(a == b)" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "hKxBY4Gx1x54", - "outputId": "9182f635-f2ca-4dae-ebb3-8b4836eed833" - }, - "execution_count": null, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "False\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "print(a > b)" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "ly80xlNG1908", - "outputId": "65b0ee5a-c41d-4452-9e45-f410562cfb40" - }, - "execution_count": null, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "True\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "print(a != b)" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "dIlI197r2iOj", - "outputId": "73ced0eb-d87a-4ee5-e5e3-58d53f3806ef" - }, - "execution_count": null, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "True\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "# more are: \">\" \"<\" \">=\" \"<=\" \"!=\"" - ], - "metadata": { - "id": "wea9jfQU2mcV" - }, - "execution_count": null, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "# Logical Operators\n", - "\n", - "# like: and, or, not\n", - "a = \"pepcoding\"\n", - "b = \"Namaste\"\n", - "print(a == \"pepcoding\" and b == \"Namaste\")" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "CyyhzYp_2ykE", - "outputId": "eb91b269-c853-4bbb-8043-740412f96b13" - }, - "execution_count": null, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "True\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "print(a == \"pp\" and b == \"Namaste\")" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "P2o_aASo3MJ-", - "outputId": "c23782f4-7199-493f-b08b-f3b05efc43f0" - }, - "execution_count": null, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "False\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "print(a == \"pepcoding\" and b == \"Nan\")" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "WtXA25Xq3QTC", - "outputId": "1b643015-983f-4884-b247-37847aee3541" - }, - "execution_count": null, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "False\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "print(a == \"pepcoding\" or b == \"Namaste\")" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "NmirGMJF3UZh", - "outputId": "7086529d-d2ae-466c-d9b8-108e11aa4399" - }, - "execution_count": null, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "True\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "print(a == \"pp\" or b == \"Namaste\")" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "hhRT85kL3YeN", - "outputId": "6f6af50c-883c-4315-f11d-2872d7b94fc0" - }, - "execution_count": null, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "True\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "print(a == \"pepcoding\" or b == \"Nan\")" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "yTuHRGKH3abI", - "outputId": "776dc1d2-4583-4351-9079-563c4730363b" - }, - "execution_count": null, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "True\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "print(not(a == \"pepcoding\" and b == \"Nan\"))" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "1fpArzks3cZu", - "outputId": "143bf6a6-8612-44c1-ba23-23d065dd6afb" - }, - "execution_count": null, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "True\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "" - ], - "metadata": { - "id": "2Ss3iNoV3jQP" - }, - "execution_count": null, - "outputs": [] - } - ] -} \ No newline at end of file diff --git a/TypesOfVariables_English.ipynb b/TypesOfVariables_English.ipynb deleted file mode 100644 index 4e4b98c..0000000 --- a/TypesOfVariables_English.ipynb +++ /dev/null @@ -1,253 +0,0 @@ -{ - "nbformat": 4, - "nbformat_minor": 0, - "metadata": { - "colab": { - "name": "TypesOfVariables_English.ipynb", - "provenance": [], - "authorship_tag": "ABX9TyNFaIr8gWQVDvv4ecRvnZx0", - "include_colab_link": true - }, - "kernelspec": { - "name": "python3", - "display_name": "Python 3" - }, - "language_info": { - "name": "python" - } - }, - "cells": [ - { - "cell_type": "markdown", - "metadata": { - "id": "view-in-github", - "colab_type": "text" - }, - "source": [ - "\"Open" - ] - }, - { - "cell_type": "markdown", - "source": [ - "Python has no command to declare variables\n" - ], - "metadata": { - "id": "GA1qS6Fs_S9H" - } - }, - { - "cell_type": "code", - "source": [ - "num = 10" - ], - "metadata": { - "id": "9ym43OUP_Z9V" - }, - "execution_count": null, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "string = 'Pepcoding'" - ], - "metadata": { - "id": "sq_DvzPd_jZv" - }, - "execution_count": null, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "flt = 2.3" - ], - "metadata": { - "id": "ifPN60_a_mPL" - }, - "execution_count": null, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "#case sensitive \n", - "\n", - "Flt = 3.3\n", - "print(flt)\n", - "print(Flt)" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "CyGFsGFd_ny7", - "outputId": "41d3315f-c862-49ee-c07b-1f49b93610ca" - }, - "execution_count": null, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "2.3\n", - "3.3\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "print(type(num))" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "X6q--RW2AFDf", - "outputId": "febd1247-5bac-434e-e32f-59b705d6c054" - }, - "execution_count": null, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "print(type(string), type(flt))" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "aO4tEdaPAI7g", - "outputId": "f22bd971-92dc-4c69-acf5-79fe8353d5a4" - }, - "execution_count": null, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - " \n" - ] - } - ] - }, - { - "cell_type": "markdown", - "source": [ - "* A variable name must start with a letter or the underscore character\n", - "* A variable name cannot start with a number\n", - "* A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ )\n", - "* Variable names are case-sensitive (age, Age and AGE are three different variables)" - ], - "metadata": { - "id": "EJCHVKJXAV85" - } - }, - { - "cell_type": "code", - "source": [ - "#some legal variables names\n", - "\n", - "pepcoding = \"pep\"\n", - "pep9coding = \"pep\"\n", - "_pepcoding = \"pep\"\n", - "pepcoding1 = \"pep\"\n", - "_pep_coding = \"pep\"\n", - "PEPcoding = \"pep\"" - ], - "metadata": { - "id": "lEUNJ92jAhR-" - }, - "execution_count": null, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "#some illegal variables names\n", - "\n", - "pep-coding = \"pep\"\n", - "9pepcoding = \"pep\"" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/", - "height": 125 - }, - "id": "ewLjYfQmBLLo", - "outputId": "213890fe-27b7-4616-d030-6bfb324ed699" - }, - "execution_count": null, - "outputs": [ - { - "output_type": "error", - "ename": "SyntaxError", - "evalue": "ignored", - "traceback": [ - "\u001b[0;36m File \u001b[0;32m\"\"\u001b[0;36m, line \u001b[0;32m4\u001b[0m\n\u001b[0;31m 9pepcoding = \"pep\"\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "a,b,c = 10,20,30\n", - "print(a, b, c)" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "6e3CGOFcBhn_", - "outputId": "7b042307-621d-4f24-cff2-b21804433f11" - }, - "execution_count": null, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "10 20 30\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "a=b=c=50\n", - "print(a,b,c)" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "7j4tJlDUBrWy", - "outputId": "ff470b12-c633-47ed-e663-61384ae5a895" - }, - "execution_count": null, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "50 50 50\n" - ] - } - ] - } - ] -} \ No newline at end of file From ed8700c9edb2de5b515156a79166437844808b09 Mon Sep 17 00:00:00 2001 From: Ritik Ramuka <56073559+ritikramuka@users.noreply.github.com> Date: Tue, 8 Feb 2022 16:58:35 +0530 Subject: [PATCH 06/41] Input Output in Python Code --- Python/I/O-Python_English.ipynb | 249 ++++++++++++++++++++++++++++++++ 1 file changed, 249 insertions(+) create mode 100644 Python/I/O-Python_English.ipynb diff --git a/Python/I/O-Python_English.ipynb b/Python/I/O-Python_English.ipynb new file mode 100644 index 0000000..8f005cd --- /dev/null +++ b/Python/I/O-Python_English.ipynb @@ -0,0 +1,249 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "name": "I/O-Python_English.ipynb", + "provenance": [], + "authorship_tag": "ABX9TyNt3EooRyqbi/+rCRg+LcFu", + "include_colab_link": true + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + } + }, + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "view-in-github", + "colab_type": "text" + }, + "source": [ + "\"Open" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "z3PHK6CdMuWf", + "outputId": "a420514a-5fdf-4af2-e671-05b08470d477" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter your name: Ritik\n" + ] + } + ], + "source": [ + "name = input(\"Enter your name: \")" + ] + }, + { + "cell_type": "code", + "source": [ + "print(name)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "b7bWmsN0ShsU", + "outputId": "b62d9bc9-f17d-438d-d546-22e95acd8251" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Ritik\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(type(name))" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "Jcs9nIwpSoTA", + "outputId": "11893ba2-6f61-4098-e269-2412abbd38e8" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "age = input(\"Enter your age: \")" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "l_1KNhk4St8H", + "outputId": "24d8ff75-1feb-49f2-ea28-b88da3912e79" + }, + "execution_count": null, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter your age: 21\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(age, type(age))" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "dxDKKOr-S50E", + "outputId": "c13f132d-d90d-4ab4-977f-5bc7a475eb1d" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "21 \n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "age = int(input(\"Enter your age: \"))" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "QNGa6XvlS-OF", + "outputId": "d9450253-534c-4045-d1b3-6ea670de6167" + }, + "execution_count": null, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter your age: 21\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(age, type(age))" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "4dtUf2KxTExr", + "outputId": "bf9131f9-98d2-40af-f92a-53a806e10dd1" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "21 \n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "salary = float(input(\"Enter your salary: \"))" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "abysRY4uTJDK", + "outputId": "4b04904f-a872-4319-ceb3-2962261645ed" + }, + "execution_count": null, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter your salary: 29.9\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(type(salary))" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "Nb2lBgj7Thon", + "outputId": "21c63e3e-2e76-427c-8e03-2543ea7fa46d" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "" + ], + "metadata": { + "id": "VtJVoki0Tn-Y" + }, + "execution_count": null, + "outputs": [] + } + ] +} \ No newline at end of file From f74051e23608cb1c5e4077d9d27e894354dabea9 Mon Sep 17 00:00:00 2001 From: Ritik Ramuka <56073559+ritikramuka@users.noreply.github.com> Date: Tue, 8 Feb 2022 17:02:31 +0530 Subject: [PATCH 07/41] Operators in Python Code --- Python/Operators_English.ipynb | 490 +++++++++++++++++++++++++++++++++ 1 file changed, 490 insertions(+) create mode 100644 Python/Operators_English.ipynb diff --git a/Python/Operators_English.ipynb b/Python/Operators_English.ipynb new file mode 100644 index 0000000..e7e7e84 --- /dev/null +++ b/Python/Operators_English.ipynb @@ -0,0 +1,490 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "name": "Operators_English.ipynb", + "provenance": [], + "authorship_tag": "ABX9TyPM6DeUwALjm2xngi2hOHbZ", + "include_colab_link": true + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + } + }, + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "view-in-github", + "colab_type": "text" + }, + "source": [ + "\"Open" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "QLllOyxIyc_z", + "outputId": "81ab843e-eb8a-494f-ca76-b437e6318a0e" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "30\n" + ] + } + ], + "source": [ + "# Arithmetic\n", + "\n", + "a = 10\n", + "b = 20\n", + "print(a + b)" + ] + }, + { + "cell_type": "code", + "source": [ + "print(a / b)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "4QMMLEDr080V", + "outputId": "8cd2333b-38bc-4c21-ea87-c01ab0624019" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "0.5\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(a % b)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "hNpvBVYX0-xy", + "outputId": "4733ef33-6527-480f-87af-aacc289d3e49" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "10\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(10 ** a)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "xKPhZfmi1A72", + "outputId": "89d9901e-1920-479e-b024-d97db21bf422" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "10000000000\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(a // b)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "Y-QzP6_G1JXm", + "outputId": "350443eb-ac8e-46b4-9784-b8dc4f6983b5" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "0\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "# Assignment Operator\n", + "\n", + "a = 10" + ], + "metadata": { + "id": "yxuuOP7s1adE" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "b += a" + ], + "metadata": { + "id": "6QfGed2R1nti" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "print(a, b)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "cuGgYJFk1oqf", + "outputId": "616b1e86-2c8c-471e-bcea-2a3cabc0f8cd" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "10 30\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "a **= 10" + ], + "metadata": { + "id": "KJQ8sjtc1rNg" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "print(a)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "I5Hn6L0D1wlq", + "outputId": "fa662f26-6ac6-49b2-ccd4-7dd033f6c60e" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "10000000000\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "# Comparison Operator\n", + "\n", + "print(a == b)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "hKxBY4Gx1x54", + "outputId": "9182f635-f2ca-4dae-ebb3-8b4836eed833" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "False\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(a > b)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "ly80xlNG1908", + "outputId": "65b0ee5a-c41d-4452-9e45-f410562cfb40" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "True\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(a != b)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "dIlI197r2iOj", + "outputId": "73ced0eb-d87a-4ee5-e5e3-58d53f3806ef" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "True\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "# more are: \">\" \"<\" \">=\" \"<=\" \"!=\"" + ], + "metadata": { + "id": "wea9jfQU2mcV" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "# Logical Operators\n", + "\n", + "# like: and, or, not\n", + "a = \"pepcoding\"\n", + "b = \"Namaste\"\n", + "print(a == \"pepcoding\" and b == \"Namaste\")" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "CyyhzYp_2ykE", + "outputId": "eb91b269-c853-4bbb-8043-740412f96b13" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "True\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(a == \"pp\" and b == \"Namaste\")" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "P2o_aASo3MJ-", + "outputId": "c23782f4-7199-493f-b08b-f3b05efc43f0" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "False\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(a == \"pepcoding\" and b == \"Nan\")" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "WtXA25Xq3QTC", + "outputId": "1b643015-983f-4884-b247-37847aee3541" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "False\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(a == \"pepcoding\" or b == \"Namaste\")" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "NmirGMJF3UZh", + "outputId": "7086529d-d2ae-466c-d9b8-108e11aa4399" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "True\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(a == \"pp\" or b == \"Namaste\")" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "hhRT85kL3YeN", + "outputId": "6f6af50c-883c-4315-f11d-2872d7b94fc0" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "True\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(a == \"pepcoding\" or b == \"Nan\")" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "yTuHRGKH3abI", + "outputId": "776dc1d2-4583-4351-9079-563c4730363b" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "True\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(not(a == \"pepcoding\" and b == \"Nan\"))" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "1fpArzks3cZu", + "outputId": "143bf6a6-8612-44c1-ba23-23d065dd6afb" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "True\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "" + ], + "metadata": { + "id": "2Ss3iNoV3jQP" + }, + "execution_count": null, + "outputs": [] + } + ] +} \ No newline at end of file From d608568fd2fb0030c55d9e2dcc6c14090ffac177 Mon Sep 17 00:00:00 2001 From: Ritik Ramuka <56073559+ritikramuka@users.noreply.github.com> Date: Tue, 8 Feb 2022 17:04:42 +0530 Subject: [PATCH 08/41] Input Output in Python Code --- Python/I_O_Python_English.ipynb | 249 ++++++++++++++++++++++++++++++++ 1 file changed, 249 insertions(+) create mode 100644 Python/I_O_Python_English.ipynb diff --git a/Python/I_O_Python_English.ipynb b/Python/I_O_Python_English.ipynb new file mode 100644 index 0000000..e673ed5 --- /dev/null +++ b/Python/I_O_Python_English.ipynb @@ -0,0 +1,249 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "name": "I/O-Python_English.ipynb", + "provenance": [], + "authorship_tag": "ABX9TyNt3EooRyqbi/+rCRg+LcFu", + "include_colab_link": true + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + } + }, + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "view-in-github", + "colab_type": "text" + }, + "source": [ + "\"Open" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "z3PHK6CdMuWf", + "outputId": "a420514a-5fdf-4af2-e671-05b08470d477" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter your name: Ritik\n" + ] + } + ], + "source": [ + "name = input(\"Enter your name: \")" + ] + }, + { + "cell_type": "code", + "source": [ + "print(name)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "b7bWmsN0ShsU", + "outputId": "b62d9bc9-f17d-438d-d546-22e95acd8251" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Ritik\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(type(name))" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "Jcs9nIwpSoTA", + "outputId": "11893ba2-6f61-4098-e269-2412abbd38e8" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "age = input(\"Enter your age: \")" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "l_1KNhk4St8H", + "outputId": "24d8ff75-1feb-49f2-ea28-b88da3912e79" + }, + "execution_count": null, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter your age: 21\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(age, type(age))" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "dxDKKOr-S50E", + "outputId": "c13f132d-d90d-4ab4-977f-5bc7a475eb1d" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "21 \n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "age = int(input(\"Enter your age: \"))" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "QNGa6XvlS-OF", + "outputId": "d9450253-534c-4045-d1b3-6ea670de6167" + }, + "execution_count": null, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter your age: 21\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(age, type(age))" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "4dtUf2KxTExr", + "outputId": "bf9131f9-98d2-40af-f92a-53a806e10dd1" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "21 \n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "salary = float(input(\"Enter your salary: \"))" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "abysRY4uTJDK", + "outputId": "4b04904f-a872-4319-ceb3-2962261645ed" + }, + "execution_count": null, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter your salary: 29.9\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(type(salary))" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "Nb2lBgj7Thon", + "outputId": "21c63e3e-2e76-427c-8e03-2543ea7fa46d" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "" + ], + "metadata": { + "id": "VtJVoki0Tn-Y" + }, + "execution_count": null, + "outputs": [] + } + ] +} \ No newline at end of file From f49fd9e2577d5e3f0c94cf6252d2f1b8e496b52b Mon Sep 17 00:00:00 2001 From: Ritik Ramuka <56073559+ritikramuka@users.noreply.github.com> Date: Tue, 8 Feb 2022 17:06:04 +0530 Subject: [PATCH 09/41] Variables in Python Code --- Python/TypesOfVariables_English.ipynb | 253 ++++++++++++++++++++++++++ 1 file changed, 253 insertions(+) create mode 100644 Python/TypesOfVariables_English.ipynb diff --git a/Python/TypesOfVariables_English.ipynb b/Python/TypesOfVariables_English.ipynb new file mode 100644 index 0000000..e52300e --- /dev/null +++ b/Python/TypesOfVariables_English.ipynb @@ -0,0 +1,253 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "name": "TypesOfVariables_English.ipynb", + "provenance": [], + "authorship_tag": "ABX9TyNFaIr8gWQVDvv4ecRvnZx0", + "include_colab_link": true + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + } + }, + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "view-in-github", + "colab_type": "text" + }, + "source": [ + "\"Open" + ] + }, + { + "cell_type": "markdown", + "source": [ + "Python has no command to declare variables\n" + ], + "metadata": { + "id": "GA1qS6Fs_S9H" + } + }, + { + "cell_type": "code", + "source": [ + "num = 10" + ], + "metadata": { + "id": "9ym43OUP_Z9V" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "string = 'Pepcoding'" + ], + "metadata": { + "id": "sq_DvzPd_jZv" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "flt = 2.3" + ], + "metadata": { + "id": "ifPN60_a_mPL" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "#case sensitive \n", + "\n", + "Flt = 3.3\n", + "print(flt)\n", + "print(Flt)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "CyGFsGFd_ny7", + "outputId": "41d3315f-c862-49ee-c07b-1f49b93610ca" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "2.3\n", + "3.3\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(type(num))" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "X6q--RW2AFDf", + "outputId": "febd1247-5bac-434e-e32f-59b705d6c054" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(type(string), type(flt))" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "aO4tEdaPAI7g", + "outputId": "f22bd971-92dc-4c69-acf5-79fe8353d5a4" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + " \n" + ] + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "* A variable name must start with a letter or the underscore character\n", + "* A variable name cannot start with a number\n", + "* A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ )\n", + "* Variable names are case-sensitive (age, Age and AGE are three different variables)" + ], + "metadata": { + "id": "EJCHVKJXAV85" + } + }, + { + "cell_type": "code", + "source": [ + "#some legal variables names\n", + "\n", + "pepcoding = \"pep\"\n", + "pep9coding = \"pep\"\n", + "_pepcoding = \"pep\"\n", + "pepcoding1 = \"pep\"\n", + "_pep_coding = \"pep\"\n", + "PEPcoding = \"pep\"" + ], + "metadata": { + "id": "lEUNJ92jAhR-" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "#some illegal variables names\n", + "\n", + "pep-coding = \"pep\"\n", + "9pepcoding = \"pep\"" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 125 + }, + "id": "ewLjYfQmBLLo", + "outputId": "213890fe-27b7-4616-d030-6bfb324ed699" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "error", + "ename": "SyntaxError", + "evalue": "ignored", + "traceback": [ + "\u001b[0;36m File \u001b[0;32m\"\"\u001b[0;36m, line \u001b[0;32m4\u001b[0m\n\u001b[0;31m 9pepcoding = \"pep\"\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "a,b,c = 10,20,30\n", + "print(a, b, c)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "6e3CGOFcBhn_", + "outputId": "7b042307-621d-4f24-cff2-b21804433f11" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "10 20 30\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "a=b=c=50\n", + "print(a,b,c)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "7j4tJlDUBrWy", + "outputId": "ff470b12-c633-47ed-e663-61384ae5a895" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "50 50 50\n" + ] + } + ] + } + ] +} \ No newline at end of file From fa0c26d85452d68bff07f2775057274752160469 Mon Sep 17 00:00:00 2001 From: ritik ramuka Date: Tue, 8 Feb 2022 17:06:58 +0530 Subject: [PATCH 10/41] Removed unwanted File --- Python/I/O-Python_English.ipynb | 249 -------------------------------- Python/README.md | 2 +- Test/TestCode.ipynb | 65 --------- 3 files changed, 1 insertion(+), 315 deletions(-) delete mode 100644 Python/I/O-Python_English.ipynb delete mode 100644 Test/TestCode.ipynb diff --git a/Python/I/O-Python_English.ipynb b/Python/I/O-Python_English.ipynb deleted file mode 100644 index 8f005cd..0000000 --- a/Python/I/O-Python_English.ipynb +++ /dev/null @@ -1,249 +0,0 @@ -{ - "nbformat": 4, - "nbformat_minor": 0, - "metadata": { - "colab": { - "name": "I/O-Python_English.ipynb", - "provenance": [], - "authorship_tag": "ABX9TyNt3EooRyqbi/+rCRg+LcFu", - "include_colab_link": true - }, - "kernelspec": { - "name": "python3", - "display_name": "Python 3" - }, - "language_info": { - "name": "python" - } - }, - "cells": [ - { - "cell_type": "markdown", - "metadata": { - "id": "view-in-github", - "colab_type": "text" - }, - "source": [ - "\"Open" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "z3PHK6CdMuWf", - "outputId": "a420514a-5fdf-4af2-e671-05b08470d477" - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Enter your name: Ritik\n" - ] - } - ], - "source": [ - "name = input(\"Enter your name: \")" - ] - }, - { - "cell_type": "code", - "source": [ - "print(name)" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "b7bWmsN0ShsU", - "outputId": "b62d9bc9-f17d-438d-d546-22e95acd8251" - }, - "execution_count": null, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "Ritik\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "print(type(name))" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "Jcs9nIwpSoTA", - "outputId": "11893ba2-6f61-4098-e269-2412abbd38e8" - }, - "execution_count": null, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "age = input(\"Enter your age: \")" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "l_1KNhk4St8H", - "outputId": "24d8ff75-1feb-49f2-ea28-b88da3912e79" - }, - "execution_count": null, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Enter your age: 21\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "print(age, type(age))" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "dxDKKOr-S50E", - "outputId": "c13f132d-d90d-4ab4-977f-5bc7a475eb1d" - }, - "execution_count": null, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "21 \n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "age = int(input(\"Enter your age: \"))" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "QNGa6XvlS-OF", - "outputId": "d9450253-534c-4045-d1b3-6ea670de6167" - }, - "execution_count": null, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Enter your age: 21\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "print(age, type(age))" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "4dtUf2KxTExr", - "outputId": "bf9131f9-98d2-40af-f92a-53a806e10dd1" - }, - "execution_count": null, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "21 \n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "salary = float(input(\"Enter your salary: \"))" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "abysRY4uTJDK", - "outputId": "4b04904f-a872-4319-ceb3-2962261645ed" - }, - "execution_count": null, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Enter your salary: 29.9\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "print(type(salary))" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "Nb2lBgj7Thon", - "outputId": "21c63e3e-2e76-427c-8e03-2543ea7fa46d" - }, - "execution_count": null, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "" - ], - "metadata": { - "id": "VtJVoki0Tn-Y" - }, - "execution_count": null, - "outputs": [] - } - ] -} \ No newline at end of file diff --git a/Python/README.md b/Python/README.md index 511eff2..620193c 100644 --- a/Python/README.md +++ b/Python/README.md @@ -1 +1 @@ -# Python Course Outline \ No newline at end of file +# Python Course \ No newline at end of file diff --git a/Test/TestCode.ipynb b/Test/TestCode.ipynb deleted file mode 100644 index 816b1bd..0000000 --- a/Test/TestCode.ipynb +++ /dev/null @@ -1,65 +0,0 @@ -{ - "nbformat": 4, - "nbformat_minor": 0, - "metadata": { - "colab": { - "name": "TestCode.ipynb", - "provenance": [], - "authorship_tag": "ABX9TyNOXfIPfIog16TTucYfcXow", - "include_colab_link": true - }, - "kernelspec": { - "name": "python3", - "display_name": "Python 3" - }, - "language_info": { - "name": "python" - } - }, - "cells": [ - { - "cell_type": "markdown", - "metadata": { - "id": "view-in-github", - "colab_type": "text" - }, - "source": [ - "\"Open" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "QZi4FlzJWcU-", - "outputId": "957814a3-ccc7-4f7f-a90d-80bb2f72a1b5" - }, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "Hello Pepcoding\n" - ] - } - ], - "source": [ - "print(\"Hello Pepcoding\")" - ] - }, - { - "cell_type": "code", - "source": [ - "" - ], - "metadata": { - "id": "S5VG7Y8PWk4a" - }, - "execution_count": null, - "outputs": [] - } - ] -} \ No newline at end of file From 9c4f8c24aba772499d63a85620c8994efc1902a6 Mon Sep 17 00:00:00 2001 From: ritik ramuka Date: Tue, 8 Feb 2022 17:08:31 +0530 Subject: [PATCH 11/41] Added Test File --- Test/TestCode.ipynb | 65 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 Test/TestCode.ipynb diff --git a/Test/TestCode.ipynb b/Test/TestCode.ipynb new file mode 100644 index 0000000..816b1bd --- /dev/null +++ b/Test/TestCode.ipynb @@ -0,0 +1,65 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "name": "TestCode.ipynb", + "provenance": [], + "authorship_tag": "ABX9TyNOXfIPfIog16TTucYfcXow", + "include_colab_link": true + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + } + }, + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "view-in-github", + "colab_type": "text" + }, + "source": [ + "\"Open" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "QZi4FlzJWcU-", + "outputId": "957814a3-ccc7-4f7f-a90d-80bb2f72a1b5" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Hello Pepcoding\n" + ] + } + ], + "source": [ + "print(\"Hello Pepcoding\")" + ] + }, + { + "cell_type": "code", + "source": [ + "" + ], + "metadata": { + "id": "S5VG7Y8PWk4a" + }, + "execution_count": null, + "outputs": [] + } + ] +} \ No newline at end of file From 216936138c4baebdf679eaa750f433ab0fd92b7e Mon Sep 17 00:00:00 2001 From: ritik ramuka Date: Tue, 8 Feb 2022 17:41:32 +0530 Subject: [PATCH 12/41] outline updated --- Python/README.md | 75 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 74 insertions(+), 1 deletion(-) diff --git a/Python/README.md b/Python/README.md index 620193c..247c3cf 100644 --- a/Python/README.md +++ b/Python/README.md @@ -1 +1,74 @@ -# Python Course \ No newline at end of file +# Python Course Overview + +## Introduction +* Python +* Why Python for Data Science +* Setting up Environment + * Google Colab + * Jupyter Notebook +## Basics +* Why we need variables | Types of variables +* I/O in Python +* Why we need operators | Types of operators | +* Conditional Operations + * If-Else Statement + * Switch Statement +* Why we need loops +* Loops + * While loop + * Basics + * While Else + * While Continue + * For loop + * Basics + * For Else + * For Continue + * Range Method + * Do While loop + * Basic + * Difference between entry controlled and exit controlled loop +* Code Indentation in Python +* Why do we need functions? +* Implementing basic functions +## Fundamentals Of Python +* What are Arrays? +* Implementing Arrays in Python +* Lists + * What are Lists in Python + * Implementing Lists in Python + * Basic operations on Lists * 2 +* Tuples + * What are Tuples in Python + * Implementing Tuples in Python + * Basic operations on Tuples * 2 +* Sets + * What are Sets in Python + * Implementing Sets in Python + * Union in Sets + * Basics operations on Sets * 2 + * Updates in Sets Data Structure in new version of python +* Packages in Python +* Standard Library in Python +* Global Variables +* Casting in python specific data type +* Strings + * Slicing + * Standard string modifiers + * Upper, lower + * Replace, Split + * Concatenation of String + * What happens when concat string and number + * Format function +* Advanced Functions + * Lambda Functions + * Basics functions containing lambda functions +* Dictionary + * What is a dictionary? + * Implementing a dictionary in Python. + * Functions of dictionary +* Racap of List, Sets, Tuples and Dictionary +* Error Handling + * Need of error handling + * Protective Approach using if-else statement + * Try and Except + * Pass Keyword From 84e3da0cc681081763920375a1b4c837f7289650 Mon Sep 17 00:00:00 2001 From: ritik ramuka Date: Tue, 8 Feb 2022 17:47:47 +0530 Subject: [PATCH 13/41] Fixed Some Markdown Voilations --- Python/README.md | 95 +++++++++++++++++++++++++----------------------- 1 file changed, 50 insertions(+), 45 deletions(-) diff --git a/Python/README.md b/Python/README.md index 247c3cf..1c93ed5 100644 --- a/Python/README.md +++ b/Python/README.md @@ -1,74 +1,79 @@ # Python Course Overview ## Introduction + * Python * Why Python for Data Science -* Setting up Environment - * Google Colab - * Jupyter Notebook +* Setting up Environment + * Google Colab + * Jupyter Notebook + ## Basics + * Why we need variables | Types of variables * I/O in Python -* Why we need operators | Types of operators | +* Why we need operators | Types of operators | * Conditional Operations - * If-Else Statement - * Switch Statement + * If-Else Statement + * Switch Statement * Why we need loops * Loops - * While loop - * Basics - * While Else - * While Continue - * For loop - * Basics - * For Else - * For Continue - * Range Method - * Do While loop - * Basic - * Difference between entry controlled and exit controlled loop + * While loop + * Basics + * While Else + * While Continue + * For loop + * Basics + * For Else + * For Continue + * Range Method + * Do While loop + * Basic + * Difference between entry controlled and exit controlled loop * Code Indentation in Python * Why do we need functions? * Implementing basic functions + ## Fundamentals Of Python + * What are Arrays? * Implementing Arrays in Python * Lists - * What are Lists in Python - * Implementing Lists in Python - * Basic operations on Lists * 2 + * What are Lists in Python + * Implementing Lists in Python + * Basic operations on Lists * 2 * Tuples - * What are Tuples in Python - * Implementing Tuples in Python - * Basic operations on Tuples * 2 + * What are Tuples in Python + * Implementing Tuples in Python + * Basic operations on Tuples * 2 * Sets - * What are Sets in Python - * Implementing Sets in Python - * Union in Sets - * Basics operations on Sets * 2 - * Updates in Sets Data Structure in new version of python + * What are Sets in Python + * Implementing Sets in Python + * Union in Sets + * Basics operations on Sets * 2 + * Updates in Sets Data Structure in new version of python * Packages in Python * Standard Library in Python * Global Variables * Casting in python specific data type * Strings - * Slicing - * Standard string modifiers - * Upper, lower - * Replace, Split - * Concatenation of String - * What happens when concat string and number - * Format function + * Slicing + * Standard string modifiers + * Upper, lower + * Replace, Split + * Concatenation of String + * What happens when concat string and number + * Format function * Advanced Functions - * Lambda Functions - * Basics functions containing lambda functions + * Lambda Functions + * Basics functions containing lambda functions * Dictionary - * What is a dictionary? - * Implementing a dictionary in Python. - * Functions of dictionary + * What is a dictionary? + * Implementing a dictionary in Python. + * Functions of dictionary * Racap of List, Sets, Tuples and Dictionary * Error Handling - * Need of error handling - * Protective Approach using if-else statement - * Try and Except - * Pass Keyword + * Need of error handling + * Protective Approach using if-else statement + * Try and Except + * Pass Keyword From 86e70607e3f95629b3472cb64c1f54bc13893f3b Mon Sep 17 00:00:00 2001 From: Ritik Ramuka <56073559+ritikramuka@users.noreply.github.com> Date: Tue, 8 Feb 2022 17:49:59 +0530 Subject: [PATCH 14/41] Update Python/README.md Co-authored-by: Aman Kumar <32238811+aman5898@users.noreply.github.com> --- Python/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Python/README.md b/Python/README.md index 1c93ed5..a918321 100644 --- a/Python/README.md +++ b/Python/README.md @@ -71,7 +71,7 @@ * What is a dictionary? * Implementing a dictionary in Python. * Functions of dictionary -* Racap of List, Sets, Tuples and Dictionary +* Recap of List, Sets, Tuples and Dictionary * Error Handling * Need of error handling * Protective Approach using if-else statement From a447a2c4cd0f62a4390f592c388d373aa9a238f4 Mon Sep 17 00:00:00 2001 From: ritik ramuka Date: Tue, 8 Feb 2022 18:36:16 +0530 Subject: [PATCH 15/41] fixed some typos on line 15 & 16 --- Python/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Python/README.md b/Python/README.md index 1c93ed5..17fd39d 100644 --- a/Python/README.md +++ b/Python/README.md @@ -12,8 +12,8 @@ * Why we need variables | Types of variables * I/O in Python -* Why we need operators | Types of operators | -* Conditional Operations +* Why we need operators | Types of operators +* Conditional Operators * If-Else Statement * Switch Statement * Why we need loops From ee5ed03e45f830881aae75754b174165670cd628 Mon Sep 17 00:00:00 2001 From: ritik ramuka Date: Tue, 8 Feb 2022 18:52:27 +0530 Subject: [PATCH 16/41] Conditional Operators types Updated --- Python/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/Python/README.md b/Python/README.md index 29823a0..299e4bb 100644 --- a/Python/README.md +++ b/Python/README.md @@ -15,7 +15,6 @@ * Why we need operators | Types of operators * Conditional Operators * If-Else Statement - * Switch Statement * Why we need loops * Loops * While loop From 8b5eef79867b4efeff4f8ec28e192c647d21855d Mon Sep 17 00:00:00 2001 From: Ritik Ramuka <56073559+ritikramuka@users.noreply.github.com> Date: Tue, 8 Feb 2022 18:59:03 +0530 Subject: [PATCH 17/41] Created using Colaboratory --- Python/ConditionalOperators_English.ipynb | 122 ++++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 Python/ConditionalOperators_English.ipynb diff --git a/Python/ConditionalOperators_English.ipynb b/Python/ConditionalOperators_English.ipynb new file mode 100644 index 0000000..b9e9b42 --- /dev/null +++ b/Python/ConditionalOperators_English.ipynb @@ -0,0 +1,122 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "name": "ConditionalOperators_English.ipynb", + "provenance": [], + "authorship_tag": "ABX9TyPFs3JKzT0pGBftguKEQE4j", + "include_colab_link": true + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + } + }, + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "view-in-github", + "colab_type": "text" + }, + "source": [ + "\"Open" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "id": "8B6Yl6gvbYyb" + }, + "outputs": [], + "source": [ + "# Conditions Operator" + ] + }, + { + "cell_type": "code", + "source": [ + "# if-else operator\n", + "\n", + "age = int(input(\"Enter your age: \"))\n", + "\n", + "if age >= 18 :\n", + " print(\"Adult\")\n", + "\n", + "if age < 18 :\n", + " print(\"Child\")\n", + "\n", + "if(age < 18) :\n", + " print(\"Child\")\n", + "else :\n", + " print(\"Adult\")" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "-q4HrTmab6PH", + "outputId": "9db3e93d-19ef-44c6-d262-136fb8e12ced" + }, + "execution_count": 10, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Enter your age: 12\n", + "Child\n", + "Child\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "age = int(input(\"Enter your age: \"))\n", + "\n", + "if age >= 60 :\n", + " print(\"Senior\")\n", + "elif age < 60 and age >= 18 :\n", + " print(\"Adult\")\n", + "else :\n", + " print(\"Child\")" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "zANmJwIjexOD", + "outputId": "251632ff-629f-4795-d814-33855f8b86d5" + }, + "execution_count": 12, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Enter your age: 45\n", + "Adult\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "" + ], + "metadata": { + "id": "_P2ho04phKIv" + }, + "execution_count": null, + "outputs": [] + } + ] +} \ No newline at end of file From 31ffd053d90f800a21ac25adf23afb807eb83a51 Mon Sep 17 00:00:00 2001 From: ritik ramuka Date: Wed, 9 Feb 2022 11:34:17 +0530 Subject: [PATCH 18/41] some changes in outline --- .DS_Store | Bin 0 -> 6148 bytes Python/README.md | 3 +-- 2 files changed, 1 insertion(+), 2 deletions(-) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..60e9d5c65f555b2f200c9ed9e790716a1e881c85 GIT binary patch literal 6148 zcmeH~O-chn5QSgqAQ3lNx)J&W0dFt~lZ6XGj0cby(Zx6eNfg}8jXa{hs%j+@XDK35 z1>LWIs(QLVnEnAEv**=0Fa|JUQWY%>m^Ke~9c1T%DmF%o=Av%zmUX)v80arH>D-TS zg;#9xi2nQuMb6kic{j7^_k3R#>!xm-2ljCNIL0;Rn4-cZb%H0Xc4#Q#Dbwy~1#WPU z4YqrJZ+m{Mh6RBj5Cnoi5cnYidS=l^C$5nPfglhBz6j|4keF1 Date: Wed, 9 Feb 2022 11:43:49 +0530 Subject: [PATCH 19/41] some changes in outline --- Python/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Python/README.md b/Python/README.md index f7e7dda..86bdb0a 100644 --- a/Python/README.md +++ b/Python/README.md @@ -22,9 +22,8 @@ * continue and break keywords * While Else * For loop - * Basics - * For Else * Range Method + * For Else * Do While loop * Basic * Difference between entry controlled and exit controlled loop From ebb3e4eb11b944f31490b7902bef098eef5a4f6e Mon Sep 17 00:00:00 2001 From: Ritik Ramuka <56073559+ritikramuka@users.noreply.github.com> Date: Wed, 9 Feb 2022 11:48:17 +0530 Subject: [PATCH 20/41] Loops in python code --- Loops_English.ipynb | 309 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 309 insertions(+) create mode 100644 Loops_English.ipynb diff --git a/Loops_English.ipynb b/Loops_English.ipynb new file mode 100644 index 0000000..abbc154 --- /dev/null +++ b/Loops_English.ipynb @@ -0,0 +1,309 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "name": "Loops_English.ipynb", + "provenance": [], + "authorship_tag": "ABX9TyOnM1ro4wXLrD2HCJp60RlA", + "include_colab_link": true + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + } + }, + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "view-in-github", + "colab_type": "text" + }, + "source": [ + "\"Open" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "id": "WQxvIzKoAVtJ" + }, + "outputs": [], + "source": [ + "# loops" + ] + }, + { + "cell_type": "code", + "source": [ + "# while loop\n", + "\n", + "print(\"Hard code method! \\n\")\n", + "\n", + "print(\"Hello Pepcoding\")\n", + "print(\"Hello Pepcoding\")\n", + "print(\"Hello Pepcoding\")\n", + "print(\"Hello Pepcoding\")\n", + "print(\"Hello Pepcoding\")\n", + "\n", + "print(\"\\n\\n\")\n", + "\n", + "print(\"While loop method! \\n\")\n", + "\n", + "i = 1\n", + "while i <= 5 :\n", + " print(\"Hello Pepcoding\")\n", + " i += 1" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "ztdRwAO2AgPz", + "outputId": "a0f4dd8a-2ddd-474b-a730-0fd8f6fd225a" + }, + "execution_count": 5, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Hard code method! \n", + "\n", + "Hello Pepcoding\n", + "Hello Pepcoding\n", + "Hello Pepcoding\n", + "Hello Pepcoding\n", + "Hello Pepcoding\n", + "\n", + "\n", + "\n", + "While loop method! \n", + "\n", + "Hello Pepcoding\n", + "Hello Pepcoding\n", + "Hello Pepcoding\n", + "Hello Pepcoding\n", + "Hello Pepcoding\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "# break and continue keyword\n", + "\n", + "i = 1\n", + "while i <= 5 :\n", + " if i == 3 :\n", + " break\n", + " print(\"Hello Pepcoding : \", i)\n", + " i += 1\n", + "\n", + "print(\"\\n\")\n", + "\n", + "i = 1\n", + "while i <= 5 :\n", + " if i == 3 :\n", + " i += 1\n", + " continue\n", + " print(\"Hello Pepcoding : \", i)\n", + " i += 1" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "Gp9qIS9yDro2", + "outputId": "130a025f-8638-4e47-bb80-1437be18931d" + }, + "execution_count": 13, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Hello Pepcoding : 1\n", + "Hello Pepcoding : 2\n", + "\n", + "\n", + "Hello Pepcoding : 1\n", + "Hello Pepcoding : 2\n", + "Hello Pepcoding : 4\n", + "Hello Pepcoding : 5\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "# while-else loop\n", + "\n", + "i = 1\n", + "while i <= 5 :\n", + " print(\"Hello Pepcoding : \", i)\n", + " i += 1\n", + "else :\n", + " print(\"No break found\")\n", + "\n", + "\n", + "print(\"\\n\")\n", + "\n", + "i = 1\n", + "while i <= 5 :\n", + " if i == 3 :\n", + " break\n", + " print(\"Hello Pepcoding : \", i)\n", + " i += 1\n", + "else :\n", + " print(\"No break found\")" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "BzsGoXT0BM9-", + "outputId": "584713c5-5a23-405c-c63d-35f3429423e8" + }, + "execution_count": 8, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Hello Pepcoding : 1\n", + "Hello Pepcoding : 2\n", + "Hello Pepcoding : 3\n", + "Hello Pepcoding : 4\n", + "Hello Pepcoding : 5\n", + "No break found\n", + "\n", + "\n", + "Hello Pepcoding : 1\n", + "Hello Pepcoding : 2\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "# for loop\n", + "\n", + "print(\"Hard code method! \\n\")\n", + "\n", + "print(\"Hello Pepcoding\")\n", + "print(\"Hello Pepcoding\")\n", + "print(\"Hello Pepcoding\")\n", + "print(\"Hello Pepcoding\")\n", + "print(\"Hello Pepcoding\")\n", + "\n", + "print(\"\\n\\n\")\n", + "\n", + "print(\"For loop method! \\n\")\n", + "\n", + "for i in range(5):\n", + " print(\"Hello Pepcoding\")\n" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "ZrLu5ZZiE0cd", + "outputId": "cbffd324-6155-4c94-d47d-42e73bbf7054" + }, + "execution_count": 14, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Hard code method! \n", + "\n", + "Hello Pepcoding\n", + "Hello Pepcoding\n", + "Hello Pepcoding\n", + "Hello Pepcoding\n", + "Hello Pepcoding\n", + "\n", + "\n", + "\n", + "For loop method! \n", + "\n", + "Hello Pepcoding\n", + "Hello Pepcoding\n", + "Hello Pepcoding\n", + "Hello Pepcoding\n", + "Hello Pepcoding\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "# for-else loop\n", + "\n", + "for i in range(5) :\n", + " print(\"Hello Pepcoding : \", i)\n", + "else :\n", + " print(\"No break found\")\n", + "\n", + "\n", + "print(\"\\n\")\n", + "\n", + "for i in range(5):\n", + " if i == 3 :\n", + " break\n", + " print(\"Hello Pepcoding : \", i)\n", + "else :\n", + " print(\"No break found\")" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "vLaeDHy4HvBe", + "outputId": "f0b864ef-a48d-4edb-ec3a-a29aa8a1f340" + }, + "execution_count": 15, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Hello Pepcoding : 0\n", + "Hello Pepcoding : 1\n", + "Hello Pepcoding : 2\n", + "Hello Pepcoding : 3\n", + "Hello Pepcoding : 4\n", + "No break found\n", + "\n", + "\n", + "Hello Pepcoding : 0\n", + "Hello Pepcoding : 1\n", + "Hello Pepcoding : 2\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "" + ], + "metadata": { + "id": "vxJzQB-dIUK5" + }, + "execution_count": null, + "outputs": [] + } + ] +} \ No newline at end of file From d5b463d48db93523e24125dccde2f6c30918c33b Mon Sep 17 00:00:00 2001 From: ritik ramuka Date: Wed, 9 Feb 2022 11:50:04 +0530 Subject: [PATCH 21/41] Loops_English.ipynb file directory changed --- Loops_English.ipynb => Python/Loops_English.ipynb | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Loops_English.ipynb => Python/Loops_English.ipynb (100%) diff --git a/Loops_English.ipynb b/Python/Loops_English.ipynb similarity index 100% rename from Loops_English.ipynb rename to Python/Loops_English.ipynb From 171ab646d8cf604cb1dee7feac5861e0e592a48f Mon Sep 17 00:00:00 2001 From: Ritik Ramuka <56073559+ritikramuka@users.noreply.github.com> Date: Wed, 9 Feb 2022 12:20:08 +0530 Subject: [PATCH 22/41] Strings in python code --- Strings_Python.ipynb | 655 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 655 insertions(+) create mode 100644 Strings_Python.ipynb diff --git a/Strings_Python.ipynb b/Strings_Python.ipynb new file mode 100644 index 0000000..81f70d0 --- /dev/null +++ b/Strings_Python.ipynb @@ -0,0 +1,655 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "name": "Strings_Python.ipynb", + "provenance": [], + "authorship_tag": "ABX9TyOlgjQPywWhwT9tzwqC5VwQ", + "include_colab_link": true + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + } + }, + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "view-in-github", + "colab_type": "text" + }, + "source": [ + "\"Open" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "id": "EbLqrwB1KKWA" + }, + "outputs": [], + "source": [ + "phrase = \"Pepcoding\"" + ] + }, + { + "cell_type": "code", + "source": [ + "print(phrase[0])" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "p_UjJp1TK3G5", + "outputId": "ac7504de-ac62-4fc3-f57c-6274cba88397" + }, + "execution_count": 2, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "P\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "phrase[0] = 'i'" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 158 + }, + "id": "1oBR4DprK4t_", + "outputId": "3c523644-2611-4868-c4a6-22accb5b8c0e" + }, + "execution_count": 3, + "outputs": [ + { + "output_type": "error", + "ename": "TypeError", + "evalue": "ignored", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mphrase\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m'i'\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m: 'str' object does not support item assignment" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "phrase[0 : 3]" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "id": "R8kFYlFFK7pN", + "outputId": "e7033f7b-9c91-4963-b2a7-d896ff17a9db" + }, + "execution_count": 4, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + }, + "text/plain": [ + "'Pep'" + ] + }, + "metadata": {}, + "execution_count": 4 + } + ] + }, + { + "cell_type": "code", + "source": [ + "phrase[0 : ]" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "id": "-NHVcJUcK_Ck", + "outputId": "dff68f51-3edc-4961-c030-2f2c18e60399" + }, + "execution_count": 5, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + }, + "text/plain": [ + "'Pepcoding'" + ] + }, + "metadata": {}, + "execution_count": 5 + } + ] + }, + { + "cell_type": "code", + "source": [ + "phrase[ : 3]" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "id": "5-2Xg7VULC5j", + "outputId": "d0cb4540-e561-4d92-dc27-46b3d95bf311" + }, + "execution_count": 6, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + }, + "text/plain": [ + "'Pep'" + ] + }, + "metadata": {}, + "execution_count": 6 + } + ] + }, + { + "cell_type": "code", + "source": [ + "phrase[ : ]" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "id": "WhWr9P4KLEDO", + "outputId": "66d15478-ed2f-4817-e496-a166e2c40f9f" + }, + "execution_count": 7, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + }, + "text/plain": [ + "'Pepcoding'" + ] + }, + "metadata": {}, + "execution_count": 7 + } + ] + }, + { + "cell_type": "code", + "source": [ + "phrase[0 : 5 : 2]" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "id": "m967rZC6LGgh", + "outputId": "498fd33d-583a-401c-e2fe-3923e94dde3d" + }, + "execution_count": 8, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + }, + "text/plain": [ + "'Ppo'" + ] + }, + "metadata": {}, + "execution_count": 8 + } + ] + }, + { + "cell_type": "code", + "source": [ + "phrase[7 : 1 : 1]" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "id": "i7db0_kGLJtj", + "outputId": "0eb7608e-d935-4997-8d2a-ee53faa541e7" + }, + "execution_count": 9, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + }, + "text/plain": [ + "''" + ] + }, + "metadata": {}, + "execution_count": 9 + } + ] + }, + { + "cell_type": "code", + "source": [ + "phrase[7 : 1 : -1]" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "id": "tr81HzIRLMvZ", + "outputId": "f8563e9f-9cb6-4c72-a574-2ba9368a0972" + }, + "execution_count": 10, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + }, + "text/plain": [ + "'nidocp'" + ] + }, + "metadata": {}, + "execution_count": 10 + } + ] + }, + { + "cell_type": "code", + "source": [ + "phrase[-1]" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "id": "6BHqQ7CgLP33", + "outputId": "be0c4fce-60ee-426e-ecf1-a389f8199e31" + }, + "execution_count": 11, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + }, + "text/plain": [ + "'g'" + ] + }, + "metadata": {}, + "execution_count": 11 + } + ] + }, + { + "cell_type": "code", + "source": [ + "phrase[-1 : -5 : -1]" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "id": "E1ViE0e9LRFD", + "outputId": "5054a431-b22d-49e7-977e-a2363802dc62" + }, + "execution_count": 12, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + }, + "text/plain": [ + "'gnid'" + ] + }, + "metadata": {}, + "execution_count": 12 + } + ] + }, + { + "cell_type": "code", + "source": [ + "phrase[ : : -1]" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "id": "fUKskCauLiQO", + "outputId": "eb94310b-e3b7-4f12-b7c2-517d782dfe64" + }, + "execution_count": 13, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + }, + "text/plain": [ + "'gnidocpeP'" + ] + }, + "metadata": {}, + "execution_count": 13 + } + ] + }, + { + "cell_type": "code", + "source": [ + "len(phrase)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "HJ8DbiJULlTE", + "outputId": "86741353-195d-473d-84f9-4c55e6ff3c65" + }, + "execution_count": 14, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "9" + ] + }, + "metadata": {}, + "execution_count": 14 + } + ] + }, + { + "cell_type": "code", + "source": [ + "phrase[-1 : -9 : -1]" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "id": "odkTpuAZO620", + "outputId": "d80434d2-0c03-47d3-bb13-9dff6130e74f" + }, + "execution_count": 15, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + }, + "text/plain": [ + "'gnidocpe'" + ] + }, + "metadata": {}, + "execution_count": 15 + } + ] + }, + { + "cell_type": "code", + "source": [ + "phrase[10 : 1]" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "id": "g6Xm8iRuPC6q", + "outputId": "8c947834-23d8-476f-d3d5-2c023f4bfb90" + }, + "execution_count": 16, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + }, + "text/plain": [ + "''" + ] + }, + "metadata": {}, + "execution_count": 16 + } + ] + }, + { + "cell_type": "code", + "source": [ + "for ch in phrase:\n", + " print(ch)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "qXhG10i9PHrt", + "outputId": "7d4d41c9-e9e3-478c-b894-a81ed055620d" + }, + "execution_count": 17, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "P\n", + "e\n", + "p\n", + "c\n", + "o\n", + "d\n", + "i\n", + "n\n", + "g\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "if \"Pep\" in phrase:\n", + " print(\"Hello\")" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "706bP1PlPKSj", + "outputId": "2d3c760c-fc25-4e4a-8bcb-367c438b7415" + }, + "execution_count": 18, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Hello\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "phrase.upper()" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "id": "WBfH1G3OPMbx", + "outputId": "49040ae5-01dd-47f8-c029-8cb6afd7b21d" + }, + "execution_count": 19, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + }, + "text/plain": [ + "'PEPCODING'" + ] + }, + "metadata": {}, + "execution_count": 19 + } + ] + }, + { + "cell_type": "code", + "source": [ + "phrase.lower()" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "id": "vs5oSYCPPQrn", + "outputId": "47fa181a-b074-40af-d7b8-0c8fe35df6af" + }, + "execution_count": 20, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + }, + "text/plain": [ + "'pepcoding'" + ] + }, + "metadata": {}, + "execution_count": 20 + } + ] + }, + { + "cell_type": "code", + "source": [ + "string = \"My name is Anthony Gonsalvis\"\n", + "\n", + "str2 = string.split(\" \")\n", + "print(str2)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "gSzoK_ZfPSa_", + "outputId": "2951b392-02fd-42b7-b5a8-dcfb90b57e4f" + }, + "execution_count": 21, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "['My', 'name', 'is', 'Anthony', 'Gonsalvis']\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(str2)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "Jstxly9iPVwG", + "outputId": "600a5459-274a-4b51-dbae-0dd1835c42f3" + }, + "execution_count": 22, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "['My', 'name', 'is', 'Anthony', 'Gonsalvis']\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "" + ], + "metadata": { + "id": "D-pY0T-hPZsq" + }, + "execution_count": null, + "outputs": [] + } + ] +} \ No newline at end of file From 93f41dca4b7650bcd45b56d3770a67ebcb3ff884 Mon Sep 17 00:00:00 2001 From: ritik ramuka Date: Wed, 9 Feb 2022 12:33:12 +0530 Subject: [PATCH 23/41] removed some unwanted file --- .DS_Store | Bin 6148 -> 6148 bytes Strings_Python.ipynb | 655 ------------------------------------------- 2 files changed, 655 deletions(-) delete mode 100644 Strings_Python.ipynb diff --git a/.DS_Store b/.DS_Store index 60e9d5c65f555b2f200c9ed9e790716a1e881c85..2b091f3f785e99d59513ee7cfb5910a509dd814c 100644 GIT binary patch delta 264 zcmZoMXfc=|#>B)qu~2NHo+2ab#DLw44=^$^vQFkB`mu~2NHo+2a5#DLw5ER%VdY&OdDyf%yvKW_AvK4xp0Fjm+Pf VC-aL~axee^BLf4|<^Yi`%m7=q5KaI9 diff --git a/Strings_Python.ipynb b/Strings_Python.ipynb deleted file mode 100644 index 81f70d0..0000000 --- a/Strings_Python.ipynb +++ /dev/null @@ -1,655 +0,0 @@ -{ - "nbformat": 4, - "nbformat_minor": 0, - "metadata": { - "colab": { - "name": "Strings_Python.ipynb", - "provenance": [], - "authorship_tag": "ABX9TyOlgjQPywWhwT9tzwqC5VwQ", - "include_colab_link": true - }, - "kernelspec": { - "name": "python3", - "display_name": "Python 3" - }, - "language_info": { - "name": "python" - } - }, - "cells": [ - { - "cell_type": "markdown", - "metadata": { - "id": "view-in-github", - "colab_type": "text" - }, - "source": [ - "\"Open" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "id": "EbLqrwB1KKWA" - }, - "outputs": [], - "source": [ - "phrase = \"Pepcoding\"" - ] - }, - { - "cell_type": "code", - "source": [ - "print(phrase[0])" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "p_UjJp1TK3G5", - "outputId": "ac7504de-ac62-4fc3-f57c-6274cba88397" - }, - "execution_count": 2, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "P\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "phrase[0] = 'i'" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/", - "height": 158 - }, - "id": "1oBR4DprK4t_", - "outputId": "3c523644-2611-4868-c4a6-22accb5b8c0e" - }, - "execution_count": 3, - "outputs": [ - { - "output_type": "error", - "ename": "TypeError", - "evalue": "ignored", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mphrase\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m'i'\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;31mTypeError\u001b[0m: 'str' object does not support item assignment" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "phrase[0 : 3]" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/", - "height": 34 - }, - "id": "R8kFYlFFK7pN", - "outputId": "e7033f7b-9c91-4963-b2a7-d896ff17a9db" - }, - "execution_count": 4, - "outputs": [ - { - "output_type": "execute_result", - "data": { - "application/vnd.google.colaboratory.intrinsic+json": { - "type": "string" - }, - "text/plain": [ - "'Pep'" - ] - }, - "metadata": {}, - "execution_count": 4 - } - ] - }, - { - "cell_type": "code", - "source": [ - "phrase[0 : ]" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/", - "height": 34 - }, - "id": "-NHVcJUcK_Ck", - "outputId": "dff68f51-3edc-4961-c030-2f2c18e60399" - }, - "execution_count": 5, - "outputs": [ - { - "output_type": "execute_result", - "data": { - "application/vnd.google.colaboratory.intrinsic+json": { - "type": "string" - }, - "text/plain": [ - "'Pepcoding'" - ] - }, - "metadata": {}, - "execution_count": 5 - } - ] - }, - { - "cell_type": "code", - "source": [ - "phrase[ : 3]" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/", - "height": 34 - }, - "id": "5-2Xg7VULC5j", - "outputId": "d0cb4540-e561-4d92-dc27-46b3d95bf311" - }, - "execution_count": 6, - "outputs": [ - { - "output_type": "execute_result", - "data": { - "application/vnd.google.colaboratory.intrinsic+json": { - "type": "string" - }, - "text/plain": [ - "'Pep'" - ] - }, - "metadata": {}, - "execution_count": 6 - } - ] - }, - { - "cell_type": "code", - "source": [ - "phrase[ : ]" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/", - "height": 34 - }, - "id": "WhWr9P4KLEDO", - "outputId": "66d15478-ed2f-4817-e496-a166e2c40f9f" - }, - "execution_count": 7, - "outputs": [ - { - "output_type": "execute_result", - "data": { - "application/vnd.google.colaboratory.intrinsic+json": { - "type": "string" - }, - "text/plain": [ - "'Pepcoding'" - ] - }, - "metadata": {}, - "execution_count": 7 - } - ] - }, - { - "cell_type": "code", - "source": [ - "phrase[0 : 5 : 2]" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/", - "height": 34 - }, - "id": "m967rZC6LGgh", - "outputId": "498fd33d-583a-401c-e2fe-3923e94dde3d" - }, - "execution_count": 8, - "outputs": [ - { - "output_type": "execute_result", - "data": { - "application/vnd.google.colaboratory.intrinsic+json": { - "type": "string" - }, - "text/plain": [ - "'Ppo'" - ] - }, - "metadata": {}, - "execution_count": 8 - } - ] - }, - { - "cell_type": "code", - "source": [ - "phrase[7 : 1 : 1]" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/", - "height": 34 - }, - "id": "i7db0_kGLJtj", - "outputId": "0eb7608e-d935-4997-8d2a-ee53faa541e7" - }, - "execution_count": 9, - "outputs": [ - { - "output_type": "execute_result", - "data": { - "application/vnd.google.colaboratory.intrinsic+json": { - "type": "string" - }, - "text/plain": [ - "''" - ] - }, - "metadata": {}, - "execution_count": 9 - } - ] - }, - { - "cell_type": "code", - "source": [ - "phrase[7 : 1 : -1]" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/", - "height": 34 - }, - "id": "tr81HzIRLMvZ", - "outputId": "f8563e9f-9cb6-4c72-a574-2ba9368a0972" - }, - "execution_count": 10, - "outputs": [ - { - "output_type": "execute_result", - "data": { - "application/vnd.google.colaboratory.intrinsic+json": { - "type": "string" - }, - "text/plain": [ - "'nidocp'" - ] - }, - "metadata": {}, - "execution_count": 10 - } - ] - }, - { - "cell_type": "code", - "source": [ - "phrase[-1]" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/", - "height": 34 - }, - "id": "6BHqQ7CgLP33", - "outputId": "be0c4fce-60ee-426e-ecf1-a389f8199e31" - }, - "execution_count": 11, - "outputs": [ - { - "output_type": "execute_result", - "data": { - "application/vnd.google.colaboratory.intrinsic+json": { - "type": "string" - }, - "text/plain": [ - "'g'" - ] - }, - "metadata": {}, - "execution_count": 11 - } - ] - }, - { - "cell_type": "code", - "source": [ - "phrase[-1 : -5 : -1]" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/", - "height": 34 - }, - "id": "E1ViE0e9LRFD", - "outputId": "5054a431-b22d-49e7-977e-a2363802dc62" - }, - "execution_count": 12, - "outputs": [ - { - "output_type": "execute_result", - "data": { - "application/vnd.google.colaboratory.intrinsic+json": { - "type": "string" - }, - "text/plain": [ - "'gnid'" - ] - }, - "metadata": {}, - "execution_count": 12 - } - ] - }, - { - "cell_type": "code", - "source": [ - "phrase[ : : -1]" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/", - "height": 34 - }, - "id": "fUKskCauLiQO", - "outputId": "eb94310b-e3b7-4f12-b7c2-517d782dfe64" - }, - "execution_count": 13, - "outputs": [ - { - "output_type": "execute_result", - "data": { - "application/vnd.google.colaboratory.intrinsic+json": { - "type": "string" - }, - "text/plain": [ - "'gnidocpeP'" - ] - }, - "metadata": {}, - "execution_count": 13 - } - ] - }, - { - "cell_type": "code", - "source": [ - "len(phrase)" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "HJ8DbiJULlTE", - "outputId": "86741353-195d-473d-84f9-4c55e6ff3c65" - }, - "execution_count": 14, - "outputs": [ - { - "output_type": "execute_result", - "data": { - "text/plain": [ - "9" - ] - }, - "metadata": {}, - "execution_count": 14 - } - ] - }, - { - "cell_type": "code", - "source": [ - "phrase[-1 : -9 : -1]" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/", - "height": 34 - }, - "id": "odkTpuAZO620", - "outputId": "d80434d2-0c03-47d3-bb13-9dff6130e74f" - }, - "execution_count": 15, - "outputs": [ - { - "output_type": "execute_result", - "data": { - "application/vnd.google.colaboratory.intrinsic+json": { - "type": "string" - }, - "text/plain": [ - "'gnidocpe'" - ] - }, - "metadata": {}, - "execution_count": 15 - } - ] - }, - { - "cell_type": "code", - "source": [ - "phrase[10 : 1]" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/", - "height": 34 - }, - "id": "g6Xm8iRuPC6q", - "outputId": "8c947834-23d8-476f-d3d5-2c023f4bfb90" - }, - "execution_count": 16, - "outputs": [ - { - "output_type": "execute_result", - "data": { - "application/vnd.google.colaboratory.intrinsic+json": { - "type": "string" - }, - "text/plain": [ - "''" - ] - }, - "metadata": {}, - "execution_count": 16 - } - ] - }, - { - "cell_type": "code", - "source": [ - "for ch in phrase:\n", - " print(ch)" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "qXhG10i9PHrt", - "outputId": "7d4d41c9-e9e3-478c-b894-a81ed055620d" - }, - "execution_count": 17, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "P\n", - "e\n", - "p\n", - "c\n", - "o\n", - "d\n", - "i\n", - "n\n", - "g\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "if \"Pep\" in phrase:\n", - " print(\"Hello\")" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "706bP1PlPKSj", - "outputId": "2d3c760c-fc25-4e4a-8bcb-367c438b7415" - }, - "execution_count": 18, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "Hello\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "phrase.upper()" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/", - "height": 34 - }, - "id": "WBfH1G3OPMbx", - "outputId": "49040ae5-01dd-47f8-c029-8cb6afd7b21d" - }, - "execution_count": 19, - "outputs": [ - { - "output_type": "execute_result", - "data": { - "application/vnd.google.colaboratory.intrinsic+json": { - "type": "string" - }, - "text/plain": [ - "'PEPCODING'" - ] - }, - "metadata": {}, - "execution_count": 19 - } - ] - }, - { - "cell_type": "code", - "source": [ - "phrase.lower()" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/", - "height": 34 - }, - "id": "vs5oSYCPPQrn", - "outputId": "47fa181a-b074-40af-d7b8-0c8fe35df6af" - }, - "execution_count": 20, - "outputs": [ - { - "output_type": "execute_result", - "data": { - "application/vnd.google.colaboratory.intrinsic+json": { - "type": "string" - }, - "text/plain": [ - "'pepcoding'" - ] - }, - "metadata": {}, - "execution_count": 20 - } - ] - }, - { - "cell_type": "code", - "source": [ - "string = \"My name is Anthony Gonsalvis\"\n", - "\n", - "str2 = string.split(\" \")\n", - "print(str2)" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "gSzoK_ZfPSa_", - "outputId": "2951b392-02fd-42b7-b5a8-dcfb90b57e4f" - }, - "execution_count": 21, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "['My', 'name', 'is', 'Anthony', 'Gonsalvis']\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "print(str2)" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "Jstxly9iPVwG", - "outputId": "600a5459-274a-4b51-dbae-0dd1835c42f3" - }, - "execution_count": 22, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "['My', 'name', 'is', 'Anthony', 'Gonsalvis']\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "" - ], - "metadata": { - "id": "D-pY0T-hPZsq" - }, - "execution_count": null, - "outputs": [] - } - ] -} \ No newline at end of file From 0a411bf29581f7ce5208ac0a521712d812faabbf Mon Sep 17 00:00:00 2001 From: Ritik Ramuka <56073559+ritikramuka@users.noreply.github.com> Date: Wed, 9 Feb 2022 12:34:15 +0530 Subject: [PATCH 24/41] String in python code --- Python/Strings_English.ipynb | 655 +++++++++++++++++++++++++++++++++++ 1 file changed, 655 insertions(+) create mode 100644 Python/Strings_English.ipynb diff --git a/Python/Strings_English.ipynb b/Python/Strings_English.ipynb new file mode 100644 index 0000000..87b5118 --- /dev/null +++ b/Python/Strings_English.ipynb @@ -0,0 +1,655 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "name": "Strings_English.ipynb", + "provenance": [], + "authorship_tag": "ABX9TyOlgjQPywWhwT9tzwqC5VwQ", + "include_colab_link": true + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + } + }, + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "view-in-github", + "colab_type": "text" + }, + "source": [ + "\"Open" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "id": "EbLqrwB1KKWA" + }, + "outputs": [], + "source": [ + "phrase = \"Pepcoding\"" + ] + }, + { + "cell_type": "code", + "source": [ + "print(phrase[0])" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "p_UjJp1TK3G5", + "outputId": "ac7504de-ac62-4fc3-f57c-6274cba88397" + }, + "execution_count": 2, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "P\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "phrase[0] = 'i'" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 158 + }, + "id": "1oBR4DprK4t_", + "outputId": "3c523644-2611-4868-c4a6-22accb5b8c0e" + }, + "execution_count": 3, + "outputs": [ + { + "output_type": "error", + "ename": "TypeError", + "evalue": "ignored", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mphrase\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m'i'\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m: 'str' object does not support item assignment" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "phrase[0 : 3]" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "id": "R8kFYlFFK7pN", + "outputId": "e7033f7b-9c91-4963-b2a7-d896ff17a9db" + }, + "execution_count": 4, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + }, + "text/plain": [ + "'Pep'" + ] + }, + "metadata": {}, + "execution_count": 4 + } + ] + }, + { + "cell_type": "code", + "source": [ + "phrase[0 : ]" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "id": "-NHVcJUcK_Ck", + "outputId": "dff68f51-3edc-4961-c030-2f2c18e60399" + }, + "execution_count": 5, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + }, + "text/plain": [ + "'Pepcoding'" + ] + }, + "metadata": {}, + "execution_count": 5 + } + ] + }, + { + "cell_type": "code", + "source": [ + "phrase[ : 3]" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "id": "5-2Xg7VULC5j", + "outputId": "d0cb4540-e561-4d92-dc27-46b3d95bf311" + }, + "execution_count": 6, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + }, + "text/plain": [ + "'Pep'" + ] + }, + "metadata": {}, + "execution_count": 6 + } + ] + }, + { + "cell_type": "code", + "source": [ + "phrase[ : ]" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "id": "WhWr9P4KLEDO", + "outputId": "66d15478-ed2f-4817-e496-a166e2c40f9f" + }, + "execution_count": 7, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + }, + "text/plain": [ + "'Pepcoding'" + ] + }, + "metadata": {}, + "execution_count": 7 + } + ] + }, + { + "cell_type": "code", + "source": [ + "phrase[0 : 5 : 2]" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "id": "m967rZC6LGgh", + "outputId": "498fd33d-583a-401c-e2fe-3923e94dde3d" + }, + "execution_count": 8, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + }, + "text/plain": [ + "'Ppo'" + ] + }, + "metadata": {}, + "execution_count": 8 + } + ] + }, + { + "cell_type": "code", + "source": [ + "phrase[7 : 1 : 1]" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "id": "i7db0_kGLJtj", + "outputId": "0eb7608e-d935-4997-8d2a-ee53faa541e7" + }, + "execution_count": 9, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + }, + "text/plain": [ + "''" + ] + }, + "metadata": {}, + "execution_count": 9 + } + ] + }, + { + "cell_type": "code", + "source": [ + "phrase[7 : 1 : -1]" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "id": "tr81HzIRLMvZ", + "outputId": "f8563e9f-9cb6-4c72-a574-2ba9368a0972" + }, + "execution_count": 10, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + }, + "text/plain": [ + "'nidocp'" + ] + }, + "metadata": {}, + "execution_count": 10 + } + ] + }, + { + "cell_type": "code", + "source": [ + "phrase[-1]" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "id": "6BHqQ7CgLP33", + "outputId": "be0c4fce-60ee-426e-ecf1-a389f8199e31" + }, + "execution_count": 11, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + }, + "text/plain": [ + "'g'" + ] + }, + "metadata": {}, + "execution_count": 11 + } + ] + }, + { + "cell_type": "code", + "source": [ + "phrase[-1 : -5 : -1]" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "id": "E1ViE0e9LRFD", + "outputId": "5054a431-b22d-49e7-977e-a2363802dc62" + }, + "execution_count": 12, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + }, + "text/plain": [ + "'gnid'" + ] + }, + "metadata": {}, + "execution_count": 12 + } + ] + }, + { + "cell_type": "code", + "source": [ + "phrase[ : : -1]" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "id": "fUKskCauLiQO", + "outputId": "eb94310b-e3b7-4f12-b7c2-517d782dfe64" + }, + "execution_count": 13, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + }, + "text/plain": [ + "'gnidocpeP'" + ] + }, + "metadata": {}, + "execution_count": 13 + } + ] + }, + { + "cell_type": "code", + "source": [ + "len(phrase)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "HJ8DbiJULlTE", + "outputId": "86741353-195d-473d-84f9-4c55e6ff3c65" + }, + "execution_count": 14, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "9" + ] + }, + "metadata": {}, + "execution_count": 14 + } + ] + }, + { + "cell_type": "code", + "source": [ + "phrase[-1 : -9 : -1]" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "id": "odkTpuAZO620", + "outputId": "d80434d2-0c03-47d3-bb13-9dff6130e74f" + }, + "execution_count": 15, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + }, + "text/plain": [ + "'gnidocpe'" + ] + }, + "metadata": {}, + "execution_count": 15 + } + ] + }, + { + "cell_type": "code", + "source": [ + "phrase[10 : 1]" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "id": "g6Xm8iRuPC6q", + "outputId": "8c947834-23d8-476f-d3d5-2c023f4bfb90" + }, + "execution_count": 16, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + }, + "text/plain": [ + "''" + ] + }, + "metadata": {}, + "execution_count": 16 + } + ] + }, + { + "cell_type": "code", + "source": [ + "for ch in phrase:\n", + " print(ch)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "qXhG10i9PHrt", + "outputId": "7d4d41c9-e9e3-478c-b894-a81ed055620d" + }, + "execution_count": 17, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "P\n", + "e\n", + "p\n", + "c\n", + "o\n", + "d\n", + "i\n", + "n\n", + "g\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "if \"Pep\" in phrase:\n", + " print(\"Hello\")" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "706bP1PlPKSj", + "outputId": "2d3c760c-fc25-4e4a-8bcb-367c438b7415" + }, + "execution_count": 18, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Hello\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "phrase.upper()" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "id": "WBfH1G3OPMbx", + "outputId": "49040ae5-01dd-47f8-c029-8cb6afd7b21d" + }, + "execution_count": 19, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + }, + "text/plain": [ + "'PEPCODING'" + ] + }, + "metadata": {}, + "execution_count": 19 + } + ] + }, + { + "cell_type": "code", + "source": [ + "phrase.lower()" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "id": "vs5oSYCPPQrn", + "outputId": "47fa181a-b074-40af-d7b8-0c8fe35df6af" + }, + "execution_count": 20, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + }, + "text/plain": [ + "'pepcoding'" + ] + }, + "metadata": {}, + "execution_count": 20 + } + ] + }, + { + "cell_type": "code", + "source": [ + "string = \"My name is Anthony Gonsalvis\"\n", + "\n", + "str2 = string.split(\" \")\n", + "print(str2)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "gSzoK_ZfPSa_", + "outputId": "2951b392-02fd-42b7-b5a8-dcfb90b57e4f" + }, + "execution_count": 21, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "['My', 'name', 'is', 'Anthony', 'Gonsalvis']\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(str2)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "Jstxly9iPVwG", + "outputId": "600a5459-274a-4b51-dbae-0dd1835c42f3" + }, + "execution_count": 22, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "['My', 'name', 'is', 'Anthony', 'Gonsalvis']\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "" + ], + "metadata": { + "id": "D-pY0T-hPZsq" + }, + "execution_count": null, + "outputs": [] + } + ] +} \ No newline at end of file From 02154e3ad76ee3b64da1201d53d410fb936a5a55 Mon Sep 17 00:00:00 2001 From: Ritik Ramuka <56073559+ritikramuka@users.noreply.github.com> Date: Wed, 9 Feb 2022 13:08:26 +0530 Subject: [PATCH 25/41] List in Python Code --- Python/List_English.ipynb | 384 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 384 insertions(+) create mode 100644 Python/List_English.ipynb diff --git a/Python/List_English.ipynb b/Python/List_English.ipynb new file mode 100644 index 0000000..50b19a6 --- /dev/null +++ b/Python/List_English.ipynb @@ -0,0 +1,384 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "name": "List_English.ipynb", + "provenance": [], + "authorship_tag": "ABX9TyORG3PUHQMw8EjCzp+WHIIt", + "include_colab_link": true + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + } + }, + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "view-in-github", + "colab_type": "text" + }, + "source": [ + "\"Open" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "id": "8bfunD47TJm4" + }, + "outputs": [], + "source": [ + "#list\n", + "\n", + "lst = [1,5,6]" + ] + }, + { + "cell_type": "code", + "source": [ + "print(type(lst))" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "zcZVYIX3Z0_U", + "outputId": "bd6929da-ef16-44a2-8d25-5cc84f6fa6ca" + }, + "execution_count": 2, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "lst.append(7)" + ], + "metadata": { + "id": "SM4W_N9GZ3GG" + }, + "execution_count": 3, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "lst.append(\"Pepcoding\")" + ], + "metadata": { + "id": "yR2sVSVjZ4zt" + }, + "execution_count": 4, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "print(lst)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "QbLWAG0HZ6d6", + "outputId": "08539aeb-cb94-4412-bf92-2ede63aa4178" + }, + "execution_count": 5, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "[1, 5, 6, 7, 'Pepcoding']\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "lst[0]=500" + ], + "metadata": { + "id": "LD1rkNNEZ8vE" + }, + "execution_count": 6, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "lst2 = [1,1]" + ], + "metadata": { + "id": "RAEF300tZ_LM" + }, + "execution_count": 7, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "lst2.append(lst)" + ], + "metadata": { + "id": "tei7QpT5aA6E" + }, + "execution_count": 8, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "print(lst2)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "2qP5awQSaChf", + "outputId": "451c2ea6-f403-44c7-e7b8-37340d65f4cb" + }, + "execution_count": 9, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "[1, 1, [500, 5, 6, 7, 'Pepcoding']]\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "lst.append(5)" + ], + "metadata": { + "id": "KNpOceGLaF-p" + }, + "execution_count": 10, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "print(lst)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "zCNEmr95aIFS", + "outputId": "fdafc273-ee15-49f4-a5c3-fca3ff01390c" + }, + "execution_count": 11, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "[500, 5, 6, 7, 'Pepcoding', 5]\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "lst[-1]" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "7EWzJKkcaKiF", + "outputId": "34f49c29-eb63-417b-8712-8ae546bd4bee" + }, + "execution_count": 12, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "5" + ] + }, + "metadata": {}, + "execution_count": 12 + } + ] + }, + { + "cell_type": "code", + "source": [ + "lst[0:2]" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "nmkQlL4VaMZ3", + "outputId": "d73470f4-abeb-400d-f241-a66193a054a8" + }, + "execution_count": 13, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "[500, 5]" + ] + }, + "metadata": {}, + "execution_count": 13 + } + ] + }, + { + "cell_type": "code", + "source": [ + "lst.insert(2,\"Pepcoder\")" + ], + "metadata": { + "id": "Mu3U6XTtaOHS" + }, + "execution_count": 14, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "print(lst)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "gJ8RVsvGaP16", + "outputId": "9981d3b6-8611-48f6-f01c-3b6e23d65d76" + }, + "execution_count": 15, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "[500, 5, 'Pepcoder', 6, 7, 'Pepcoding', 5]\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "lst.remove(6)" + ], + "metadata": { + "id": "CZ86p1TgaRxy" + }, + "execution_count": 16, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "print(lst)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "l3_UDgzraULz", + "outputId": "3a87530b-acb3-4b59-8598-4307af376514" + }, + "execution_count": 17, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "[500, 5, 'Pepcoder', 7, 'Pepcoding', 5]\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(lst.pop())" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "2CrfJnLTaWGG", + "outputId": "45033b7d-c296-4e54-cf94-77f7db9e4230" + }, + "execution_count": 18, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "5\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "for i in lst:\n", + " print(i)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "L3dzgukbaYPz", + "outputId": "32d6e864-65bc-449e-e067-b20b69bbd798" + }, + "execution_count": 19, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "500\n", + "5\n", + "Pepcoder\n", + "7\n", + "Pepcoding\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "" + ], + "metadata": { + "id": "VCsh9OMiaatA" + }, + "execution_count": null, + "outputs": [] + } + ] +} \ No newline at end of file From 7f8051c50193a94fd0bcbb3b51cfee20a405eda5 Mon Sep 17 00:00:00 2001 From: Ritik Ramuka <56073559+ritikramuka@users.noreply.github.com> Date: Wed, 9 Feb 2022 13:15:51 +0530 Subject: [PATCH 26/41] tuple in python code --- Tuples_English.ipynb | 263 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 263 insertions(+) create mode 100644 Tuples_English.ipynb diff --git a/Tuples_English.ipynb b/Tuples_English.ipynb new file mode 100644 index 0000000..bec3b38 --- /dev/null +++ b/Tuples_English.ipynb @@ -0,0 +1,263 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "name": "Tuples_English.ipynb", + "provenance": [], + "authorship_tag": "ABX9TyOE1EAapAilILuxLR5IynC+", + "include_colab_link": true + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + } + }, + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "view-in-github", + "colab_type": "text" + }, + "source": [ + "\"Open" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "id": "5DTge4jDbapb" + }, + "outputs": [], + "source": [ + "tup = (1, 2, 3, \"Hello\")" + ] + }, + { + "cell_type": "code", + "source": [ + "print(type(tup))" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "_MCtQYl8bhan", + "outputId": "98df2197-6a43-4a01-e8fa-1acc1ad1a1b6" + }, + "execution_count": 2, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "tup = 1, 2, 3, \"Hello\"" + ], + "metadata": { + "id": "LUgl5icUbjDD" + }, + "execution_count": 3, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "tup2 = (99, )" + ], + "metadata": { + "id": "vr2Vqa7jbkot" + }, + "execution_count": 4, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "print(type(tup2))" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "dUx78ZYLbmIJ", + "outputId": "9aee354b-2012-4d05-a973-0f098a397d34" + }, + "execution_count": 5, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(tup[0])" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "y1LCv7YLbsqd", + "outputId": "af9ae47d-cb03-4230-d1bf-dd933db84f71" + }, + "execution_count": 6, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "1\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "tup[0] = 5" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 158 + }, + "id": "OJlJUbTpbuiQ", + "outputId": "848284f6-b484-4f93-8de6-7d840e058583" + }, + "execution_count": 7, + "outputs": [ + { + "output_type": "error", + "ename": "TypeError", + "evalue": "ignored", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mtup\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m5\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m: 'tuple' object does not support item assignment" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "for i in tup:\n", + " print(i)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "HpU2QQIibwTM", + "outputId": "1dc19aff-9bab-4f44-ae5f-7e1959742527" + }, + "execution_count": 8, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "1\n", + "2\n", + "3\n", + "Hello\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "tup.append(5)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 158 + }, + "id": "9isWLDECbzB3", + "outputId": "798f9102-b776-4b78-a48d-de419f9003bf" + }, + "execution_count": 9, + "outputs": [ + { + "output_type": "error", + "ename": "AttributeError", + "evalue": "ignored", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mtup\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m5\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mAttributeError\u001b[0m: 'tuple' object has no attribute 'append'" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "# contractor method\n", + "\n", + "tup3 = tuple((1, 2, 3))" + ], + "metadata": { + "id": "Ok5qVJ9Db1aL" + }, + "execution_count": 11, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "print(tup3)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "_3Y8cImMb5mM", + "outputId": "da5e0303-b14b-4dea-8e98-638adf3c3730" + }, + "execution_count": 12, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "(1, 2, 3)\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "" + ], + "metadata": { + "id": "saBTMGdlb-rs" + }, + "execution_count": null, + "outputs": [] + } + ] +} \ No newline at end of file From 31e371ada50ac6c7d2b9b756f312d048fda24fb1 Mon Sep 17 00:00:00 2001 From: Ritik Ramuka <56073559+ritikramuka@users.noreply.github.com> Date: Wed, 9 Feb 2022 13:17:58 +0530 Subject: [PATCH 27/41] List in python code --- Python/List_English.ipynb | 69 +++++++++++++++++++++++++++------------ 1 file changed, 48 insertions(+), 21 deletions(-) diff --git a/Python/List_English.ipynb b/Python/List_English.ipynb index 50b19a6..32de02c 100644 --- a/Python/List_English.ipynb +++ b/Python/List_English.ipynb @@ -5,7 +5,7 @@ "colab": { "name": "List_English.ipynb", "provenance": [], - "authorship_tag": "ABX9TyORG3PUHQMw8EjCzp+WHIIt", + "authorship_tag": "ABX9TyN/AlRqw09/Hv3EuxbvQlSU", "include_colab_link": true }, "kernelspec": { @@ -29,7 +29,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": { "id": "8bfunD47TJm4" }, @@ -52,7 +52,7 @@ "id": "zcZVYIX3Z0_U", "outputId": "bd6929da-ef16-44a2-8d25-5cc84f6fa6ca" }, - "execution_count": 2, + "execution_count": null, "outputs": [ { "output_type": "stream", @@ -71,7 +71,7 @@ "metadata": { "id": "SM4W_N9GZ3GG" }, - "execution_count": 3, + "execution_count": null, "outputs": [] }, { @@ -82,7 +82,7 @@ "metadata": { "id": "yR2sVSVjZ4zt" }, - "execution_count": 4, + "execution_count": null, "outputs": [] }, { @@ -97,7 +97,7 @@ "id": "QbLWAG0HZ6d6", "outputId": "08539aeb-cb94-4412-bf92-2ede63aa4178" }, - "execution_count": 5, + "execution_count": null, "outputs": [ { "output_type": "stream", @@ -116,7 +116,7 @@ "metadata": { "id": "LD1rkNNEZ8vE" }, - "execution_count": 6, + "execution_count": null, "outputs": [] }, { @@ -127,7 +127,7 @@ "metadata": { "id": "RAEF300tZ_LM" }, - "execution_count": 7, + "execution_count": null, "outputs": [] }, { @@ -138,7 +138,7 @@ "metadata": { "id": "tei7QpT5aA6E" }, - "execution_count": 8, + "execution_count": null, "outputs": [] }, { @@ -153,7 +153,7 @@ "id": "2qP5awQSaChf", "outputId": "451c2ea6-f403-44c7-e7b8-37340d65f4cb" }, - "execution_count": 9, + "execution_count": null, "outputs": [ { "output_type": "stream", @@ -172,7 +172,7 @@ "metadata": { "id": "KNpOceGLaF-p" }, - "execution_count": 10, + "execution_count": null, "outputs": [] }, { @@ -187,7 +187,7 @@ "id": "zCNEmr95aIFS", "outputId": "fdafc273-ee15-49f4-a5c3-fca3ff01390c" }, - "execution_count": 11, + "execution_count": null, "outputs": [ { "output_type": "stream", @@ -210,7 +210,7 @@ "id": "7EWzJKkcaKiF", "outputId": "34f49c29-eb63-417b-8712-8ae546bd4bee" }, - "execution_count": 12, + "execution_count": null, "outputs": [ { "output_type": "execute_result", @@ -236,7 +236,7 @@ "id": "nmkQlL4VaMZ3", "outputId": "d73470f4-abeb-400d-f241-a66193a054a8" }, - "execution_count": 13, + "execution_count": null, "outputs": [ { "output_type": "execute_result", @@ -258,7 +258,7 @@ "metadata": { "id": "Mu3U6XTtaOHS" }, - "execution_count": 14, + "execution_count": null, "outputs": [] }, { @@ -273,7 +273,7 @@ "id": "gJ8RVsvGaP16", "outputId": "9981d3b6-8611-48f6-f01c-3b6e23d65d76" }, - "execution_count": 15, + "execution_count": null, "outputs": [ { "output_type": "stream", @@ -292,7 +292,7 @@ "metadata": { "id": "CZ86p1TgaRxy" }, - "execution_count": 16, + "execution_count": null, "outputs": [] }, { @@ -307,7 +307,7 @@ "id": "l3_UDgzraULz", "outputId": "3a87530b-acb3-4b59-8598-4307af376514" }, - "execution_count": 17, + "execution_count": null, "outputs": [ { "output_type": "stream", @@ -330,7 +330,7 @@ "id": "2CrfJnLTaWGG", "outputId": "45033b7d-c296-4e54-cf94-77f7db9e4230" }, - "execution_count": 18, + "execution_count": null, "outputs": [ { "output_type": "stream", @@ -354,7 +354,7 @@ "id": "L3dzgukbaYPz", "outputId": "32d6e864-65bc-449e-e067-b20b69bbd798" }, - "execution_count": 19, + "execution_count": null, "outputs": [ { "output_type": "stream", @@ -369,13 +369,40 @@ } ] }, + { + "cell_type": "code", + "source": [ + "# constructor method\n", + "lst3 = list((1, 2, \"Pepcoding\"))\n", + "print(type(lst3))\n", + "print(lst3)" + ], + "metadata": { + "id": "VCsh9OMiaatA", + "outputId": "c0abb487-9640-47b6-8b74-e1fe79974e77", + "colab": { + "base_uri": "https://localhost:8080/" + } + }, + "execution_count": 1, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "\n", + "[1, 2, 'Pepcoding']\n" + ] + } + ] + }, { "cell_type": "code", "source": [ "" ], "metadata": { - "id": "VCsh9OMiaatA" + "id": "Ztcbsjqec2qR" }, "execution_count": null, "outputs": [] From 1de092db1fd6a5fee3d82699b5d02e0868e6179f Mon Sep 17 00:00:00 2001 From: Ritik Ramuka <56073559+ritikramuka@users.noreply.github.com> Date: Wed, 9 Feb 2022 13:19:53 +0530 Subject: [PATCH 28/41] tuple in python code --- Python/Tuples_English.ipynb | 263 ++++++++++++++++++++++++++++++++++++ 1 file changed, 263 insertions(+) create mode 100644 Python/Tuples_English.ipynb diff --git a/Python/Tuples_English.ipynb b/Python/Tuples_English.ipynb new file mode 100644 index 0000000..0c1073b --- /dev/null +++ b/Python/Tuples_English.ipynb @@ -0,0 +1,263 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "name": "Tuples_English.ipynb", + "provenance": [], + "authorship_tag": "ABX9TyOE1EAapAilILuxLR5IynC+", + "include_colab_link": true + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + } + }, + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "view-in-github", + "colab_type": "text" + }, + "source": [ + "\"Open" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "5DTge4jDbapb" + }, + "outputs": [], + "source": [ + "tup = (1, 2, 3, \"Hello\")" + ] + }, + { + "cell_type": "code", + "source": [ + "print(type(tup))" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "_MCtQYl8bhan", + "outputId": "98df2197-6a43-4a01-e8fa-1acc1ad1a1b6" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "tup = 1, 2, 3, \"Hello\"" + ], + "metadata": { + "id": "LUgl5icUbjDD" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "tup2 = (99, )" + ], + "metadata": { + "id": "vr2Vqa7jbkot" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "print(type(tup2))" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "dUx78ZYLbmIJ", + "outputId": "9aee354b-2012-4d05-a973-0f098a397d34" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(tup[0])" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "y1LCv7YLbsqd", + "outputId": "af9ae47d-cb03-4230-d1bf-dd933db84f71" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "1\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "tup[0] = 5" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 158 + }, + "id": "OJlJUbTpbuiQ", + "outputId": "848284f6-b484-4f93-8de6-7d840e058583" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "error", + "ename": "TypeError", + "evalue": "ignored", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mtup\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m5\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m: 'tuple' object does not support item assignment" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "for i in tup:\n", + " print(i)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "HpU2QQIibwTM", + "outputId": "1dc19aff-9bab-4f44-ae5f-7e1959742527" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "1\n", + "2\n", + "3\n", + "Hello\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "tup.append(5)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 158 + }, + "id": "9isWLDECbzB3", + "outputId": "798f9102-b776-4b78-a48d-de419f9003bf" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "error", + "ename": "AttributeError", + "evalue": "ignored", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mtup\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m5\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mAttributeError\u001b[0m: 'tuple' object has no attribute 'append'" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "# contractor method\n", + "\n", + "tup3 = tuple((1, 2, 3))" + ], + "metadata": { + "id": "Ok5qVJ9Db1aL" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "print(tup3)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "_3Y8cImMb5mM", + "outputId": "da5e0303-b14b-4dea-8e98-638adf3c3730" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "(1, 2, 3)\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "" + ], + "metadata": { + "id": "saBTMGdlb-rs" + }, + "execution_count": null, + "outputs": [] + } + ] +} \ No newline at end of file From d442210a5045e088d633dfb84a95081aedaf4acc Mon Sep 17 00:00:00 2001 From: Ritik Ramuka <56073559+ritikramuka@users.noreply.github.com> Date: Wed, 9 Feb 2022 13:30:23 +0530 Subject: [PATCH 29/41] Sets in python code --- Python/Set_English.ipynb | 410 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 410 insertions(+) create mode 100644 Python/Set_English.ipynb diff --git a/Python/Set_English.ipynb b/Python/Set_English.ipynb new file mode 100644 index 0000000..06b1b2a --- /dev/null +++ b/Python/Set_English.ipynb @@ -0,0 +1,410 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "name": "Set_English.ipynb", + "provenance": [], + "authorship_tag": "ABX9TyNcBp0GUJ45SeqkNhQOUtRv", + "include_colab_link": true + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + } + }, + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "view-in-github", + "colab_type": "text" + }, + "source": [ + "\"Open" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "id": "oYkr7qc9dUH7" + }, + "outputs": [], + "source": [ + "st = {\"Apple\", \"Banana\", \"Mango\"}" + ] + }, + { + "cell_type": "code", + "source": [ + "print(st)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "GGFovFaTdlsW", + "outputId": "8270bc42-271c-4a4f-9dbe-83695e43600c" + }, + "execution_count": 2, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "{'Apple', 'Banana', 'Mango'}\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "st[0]" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 158 + }, + "id": "cPz-LHG4dpNC", + "outputId": "cec9b485-ee97-4f6b-f484-8597dc809991" + }, + "execution_count": 3, + "outputs": [ + { + "output_type": "error", + "ename": "TypeError", + "evalue": "ignored", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mst\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m: 'set' object is not subscriptable" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "st = {\"Apple\", \"Banana\", \"Mango\", \"Banana\", 5, 6}" + ], + "metadata": { + "id": "UXcQ-t9Wdq5J" + }, + "execution_count": 5, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "st" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "pgpOEtdedxPt", + "outputId": "5a947a1f-5653-41e4-c921-0678d0e3c126" + }, + "execution_count": 6, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "{5, 6, 'Apple', 'Banana', 'Mango'}" + ] + }, + "metadata": {}, + "execution_count": 6 + } + ] + }, + { + "cell_type": "code", + "source": [ + "#sets are immutable\n", + "\n", + "st.add(\"Orange\")" + ], + "metadata": { + "id": "s2jCD5-7d0ij" + }, + "execution_count": 7, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "st.remove('Banana')" + ], + "metadata": { + "id": "Ogp6ZEZid3QL" + }, + "execution_count": 8, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "st = {1, 2, 3, [\"Apple\", \"orange\"]}" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 158 + }, + "id": "5UD3Y3uXd5KP", + "outputId": "32d01bf4-1f01-4324-ad86-745ca958dd95" + }, + "execution_count": 10, + "outputs": [ + { + "output_type": "error", + "ename": "TypeError", + "evalue": "ignored", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mst\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m{\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m2\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m3\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m\"Apple\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"orange\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m: unhashable type: 'list'" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "st = {1, 2, 3, (\"Apple\", \"orange\")}" + ], + "metadata": { + "id": "AVkRcZv7d7Gk" + }, + "execution_count": 12, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "st" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "kn-n_1PSeDzE", + "outputId": "25ec8306-0102-4883-d131-9551d08d0af6" + }, + "execution_count": 13, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "{('Apple', 'orange'), 1, 2, 3}" + ] + }, + "metadata": {}, + "execution_count": 13 + } + ] + }, + { + "cell_type": "code", + "source": [ + "for x in st:\n", + " print(x)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "9sLcSgwPeFmT", + "outputId": "706b926d-b300-4136-fed8-241729fe7abb" + }, + "execution_count": 14, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "1\n", + "2\n", + "3\n", + "('Apple', 'orange')\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "st.pop()" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "gMugv9-5eHfG", + "outputId": "bf4dff75-ef87-4b7a-c91a-b99f7148add9" + }, + "execution_count": 15, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "1" + ] + }, + "metadata": {}, + "execution_count": 15 + } + ] + }, + { + "cell_type": "code", + "source": [ + "st.clear()" + ], + "metadata": { + "id": "DwWcFo1xeJ9z" + }, + "execution_count": 16, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "st" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "y3l_58B-eN0d", + "outputId": "61c5e31d-863c-46d9-c83f-8553ed678ba2" + }, + "execution_count": 17, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "set()" + ] + }, + "metadata": {}, + "execution_count": 17 + } + ] + }, + { + "cell_type": "code", + "source": [ + "del st" + ], + "metadata": { + "id": "W20AP1DDeOmZ" + }, + "execution_count": 18, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "st" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 158 + }, + "id": "XANyD_UIePaA", + "outputId": "a2e93a9c-ad15-4515-813b-d7ce95094e98" + }, + "execution_count": 19, + "outputs": [ + { + "output_type": "error", + "ename": "NameError", + "evalue": "ignored", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mst\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mNameError\u001b[0m: name 'st' is not defined" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "# union and intersection\n", + "\n", + "set1 = {1, 2, 3, 4, 5}\n", + "set2 = {2, 5, 8, 9}\n", + "\n", + "print(set1.union(set2))" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "gpooCDboeRKm", + "outputId": "42c66b38-600d-4034-c3c1-b8d13b7555f3" + }, + "execution_count": 21, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "{1, 2, 3, 4, 5, 8, 9}\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(set1.intersection(set2))" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "MpzYLsOHeS2m", + "outputId": "a3baacc5-3f63-4305-ee57-c095ed45b60d" + }, + "execution_count": 22, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "{2, 5}\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "" + ], + "metadata": { + "id": "Ex32xdO8foCb" + }, + "execution_count": null, + "outputs": [] + } + ] +} \ No newline at end of file From d206d535f1859bdc713a954bc9547e4af9e1e5f6 Mon Sep 17 00:00:00 2001 From: Ritik Ramuka <56073559+ritikramuka@users.noreply.github.com> Date: Wed, 9 Feb 2022 13:38:59 +0530 Subject: [PATCH 30/41] constructor method of sets added --- Python/Set_English.ipynb | 68 ++++++++++++++++++++++++++++------------ 1 file changed, 48 insertions(+), 20 deletions(-) diff --git a/Python/Set_English.ipynb b/Python/Set_English.ipynb index 06b1b2a..f5b1e03 100644 --- a/Python/Set_English.ipynb +++ b/Python/Set_English.ipynb @@ -5,7 +5,7 @@ "colab": { "name": "Set_English.ipynb", "provenance": [], - "authorship_tag": "ABX9TyNcBp0GUJ45SeqkNhQOUtRv", + "authorship_tag": "ABX9TyMvque0LGgny9kALiB2a3bR", "include_colab_link": true }, "kernelspec": { @@ -29,7 +29,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": { "id": "oYkr7qc9dUH7" }, @@ -50,7 +50,7 @@ "id": "GGFovFaTdlsW", "outputId": "8270bc42-271c-4a4f-9dbe-83695e43600c" }, - "execution_count": 2, + "execution_count": null, "outputs": [ { "output_type": "stream", @@ -74,7 +74,7 @@ "id": "cPz-LHG4dpNC", "outputId": "cec9b485-ee97-4f6b-f484-8597dc809991" }, - "execution_count": 3, + "execution_count": null, "outputs": [ { "output_type": "error", @@ -97,7 +97,7 @@ "metadata": { "id": "UXcQ-t9Wdq5J" }, - "execution_count": 5, + "execution_count": null, "outputs": [] }, { @@ -112,7 +112,7 @@ "id": "pgpOEtdedxPt", "outputId": "5a947a1f-5653-41e4-c921-0678d0e3c126" }, - "execution_count": 6, + "execution_count": null, "outputs": [ { "output_type": "execute_result", @@ -136,7 +136,7 @@ "metadata": { "id": "s2jCD5-7d0ij" }, - "execution_count": 7, + "execution_count": null, "outputs": [] }, { @@ -147,7 +147,7 @@ "metadata": { "id": "Ogp6ZEZid3QL" }, - "execution_count": 8, + "execution_count": null, "outputs": [] }, { @@ -163,7 +163,7 @@ "id": "5UD3Y3uXd5KP", "outputId": "32d01bf4-1f01-4324-ad86-745ca958dd95" }, - "execution_count": 10, + "execution_count": null, "outputs": [ { "output_type": "error", @@ -186,7 +186,7 @@ "metadata": { "id": "AVkRcZv7d7Gk" }, - "execution_count": 12, + "execution_count": null, "outputs": [] }, { @@ -201,7 +201,7 @@ "id": "kn-n_1PSeDzE", "outputId": "25ec8306-0102-4883-d131-9551d08d0af6" }, - "execution_count": 13, + "execution_count": null, "outputs": [ { "output_type": "execute_result", @@ -228,7 +228,7 @@ "id": "9sLcSgwPeFmT", "outputId": "706b926d-b300-4136-fed8-241729fe7abb" }, - "execution_count": 14, + "execution_count": null, "outputs": [ { "output_type": "stream", @@ -254,7 +254,7 @@ "id": "gMugv9-5eHfG", "outputId": "bf4dff75-ef87-4b7a-c91a-b99f7148add9" }, - "execution_count": 15, + "execution_count": null, "outputs": [ { "output_type": "execute_result", @@ -276,7 +276,7 @@ "metadata": { "id": "DwWcFo1xeJ9z" }, - "execution_count": 16, + "execution_count": null, "outputs": [] }, { @@ -291,7 +291,7 @@ "id": "y3l_58B-eN0d", "outputId": "61c5e31d-863c-46d9-c83f-8553ed678ba2" }, - "execution_count": 17, + "execution_count": null, "outputs": [ { "output_type": "execute_result", @@ -313,7 +313,7 @@ "metadata": { "id": "W20AP1DDeOmZ" }, - "execution_count": 18, + "execution_count": null, "outputs": [] }, { @@ -329,7 +329,7 @@ "id": "XANyD_UIePaA", "outputId": "a2e93a9c-ad15-4515-813b-d7ce95094e98" }, - "execution_count": 19, + "execution_count": null, "outputs": [ { "output_type": "error", @@ -361,7 +361,7 @@ "id": "gpooCDboeRKm", "outputId": "42c66b38-600d-4034-c3c1-b8d13b7555f3" }, - "execution_count": 21, + "execution_count": null, "outputs": [ { "output_type": "stream", @@ -384,7 +384,7 @@ "id": "MpzYLsOHeS2m", "outputId": "a3baacc5-3f63-4305-ee57-c095ed45b60d" }, - "execution_count": 22, + "execution_count": null, "outputs": [ { "output_type": "stream", @@ -395,13 +395,41 @@ } ] }, + { + "cell_type": "code", + "source": [ + "# Constructor Implementation\n", + "\n", + "set3 = set((1, 2, 3, 4, 5))\n", + "print(type(set3))\n", + "print(set3)" + ], + "metadata": { + "id": "Ex32xdO8foCb", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "4a57d579-dff2-482d-ba20-1236d2557bb5" + }, + "execution_count": 23, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "\n", + "{1, 2, 3, 4, 5}\n" + ] + } + ] + }, { "cell_type": "code", "source": [ "" ], "metadata": { - "id": "Ex32xdO8foCb" + "id": "0E2YPGhWhrg3" }, "execution_count": null, "outputs": [] From f934d697d1784a6ec224ed0faf0cd08f599cf5f1 Mon Sep 17 00:00:00 2001 From: Ritik Ramuka <56073559+ritikramuka@users.noreply.github.com> Date: Wed, 9 Feb 2022 13:47:44 +0530 Subject: [PATCH 31/41] dictionary in python code --- Python/Dictionary_English.ipynb | 426 ++++++++++++++++++++++++++++++++ 1 file changed, 426 insertions(+) create mode 100644 Python/Dictionary_English.ipynb diff --git a/Python/Dictionary_English.ipynb b/Python/Dictionary_English.ipynb new file mode 100644 index 0000000..dc7d1dd --- /dev/null +++ b/Python/Dictionary_English.ipynb @@ -0,0 +1,426 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "name": "Dictionary_English.ipynb", + "provenance": [], + "authorship_tag": "ABX9TyMSdeqnQa7cEHJRi35MGNt1", + "include_colab_link": true + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + } + }, + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "view-in-github", + "colab_type": "text" + }, + "source": [ + "\"Open" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "id": "8yl20PP0hYyg" + }, + "outputs": [], + "source": [ + "my_dict = {\n", + " \"Name\" : \"Pepper\",\n", + " \"Age\" : 4,\n", + " \"Gender\" : \"Male\",\n", + "}" + ] + }, + { + "cell_type": "code", + "source": [ + "print(my_dict)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "olXYPtfCh9jr", + "outputId": "b88c4e16-0c8d-4e9e-8c27-1f80f75f9ec5" + }, + "execution_count": 2, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "{'Name': 'Pepper', 'Age': 4, 'Gender': 'Male'}\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "my_dict[\"Height\"] = 5.5" + ], + "metadata": { + "id": "5phEWtJCiCph" + }, + "execution_count": 3, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "print(my_dict)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "KfHSCLkQiFKM", + "outputId": "f7cd801e-31b7-4a61-959a-8598171b7e3d" + }, + "execution_count": 4, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "{'Name': 'Pepper', 'Age': 4, 'Gender': 'Male', 'Height': 5.5}\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(my_dict[\"Name\"])" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "bnmPCKjviG0v", + "outputId": "de092d4c-0f6e-4391-fdb9-8485177447af" + }, + "execution_count": 5, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Pepper\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "my_dict[\"Name\"] = \"Pepcoding\"" + ], + "metadata": { + "id": "QU5uSQSPiKDa" + }, + "execution_count": 6, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "my_dict.pop(\"Height\")" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "DcViRKVuiU9F", + "outputId": "792e58d7-02e9-4392-b91c-387f70f4fcd4" + }, + "execution_count": 7, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "5.5" + ] + }, + "metadata": {}, + "execution_count": 7 + } + ] + }, + { + "cell_type": "code", + "source": [ + "my_dict.pop(\"Height\")" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 158 + }, + "id": "wcFWBjFaiWW7", + "outputId": "eb28da36-16db-4408-cc4f-9aff0f4ec37f" + }, + "execution_count": 8, + "outputs": [ + { + "output_type": "error", + "ename": "KeyError", + "evalue": "ignored", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mmy_dict\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpop\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Height\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mKeyError\u001b[0m: 'Height'" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "my_dict" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "svSLB5vSiYUs", + "outputId": "155d8e3e-8be6-4fb6-987b-60296237209c" + }, + "execution_count": 9, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "{'Age': 4, 'Gender': 'Male', 'Name': 'Pepcoding'}" + ] + }, + "metadata": {}, + "execution_count": 9 + } + ] + }, + { + "cell_type": "code", + "source": [ + "for key in my_dict.keys():\n", + " print(key)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "Y0ii32zSiZdC", + "outputId": "5a945bad-175a-4dc5-8c50-1211250f5b86" + }, + "execution_count": 10, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Name\n", + "Age\n", + "Gender\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "for value in my_dict.values():\n", + " print(value)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "Jjtfgs-oifpt", + "outputId": "730ff102-2278-4db8-eda8-ef5a98a3069b" + }, + "execution_count": 11, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Pepcoding\n", + "4\n", + "Male\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "dict2 = my_dict.copy()" + ], + "metadata": { + "id": "lFKpVGZkijBa" + }, + "execution_count": 12, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "del my_dict" + ], + "metadata": { + "id": "DNPM4KZcimk6" + }, + "execution_count": 13, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "my_dict" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 158 + }, + "id": "p_tiO0MwitAH", + "outputId": "31ce5422-0b53-4d50-fd00-733937757f3a" + }, + "execution_count": 14, + "outputs": [ + { + "output_type": "error", + "ename": "NameError", + "evalue": "ignored", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mmy_dict\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mNameError\u001b[0m: name 'my_dict' is not defined" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(dict2)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "b3Uy0VR_it_R", + "outputId": "449d46bd-8624-49b9-9f92-5a7b4f7a0190" + }, + "execution_count": 15, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "{'Name': 'Pepcoding', 'Age': 4, 'Gender': 'Male'}\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "dict3 = {\n", + " \"test\": dict2\n", + "}" + ], + "metadata": { + "id": "Ja8ug5eXivET" + }, + "execution_count": 17, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "print(dict3)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "F6Nnvtq8ixt8", + "outputId": "5315eb34-5248-4c8e-9044-81a6a0ff5918" + }, + "execution_count": 18, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "{'test': {'Name': 'Pepcoding', 'Age': 4, 'Gender': 'Male'}}\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "dict3[\"new\"] = (1,2,3)" + ], + "metadata": { + "id": "hI65-dutjC57" + }, + "execution_count": 19, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "dict3.pop(\"test\")" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "X6-GcP8RjEz1", + "outputId": "f48e6c8e-2a94-4ece-cb9c-c4e14305bf77" + }, + "execution_count": 20, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "{'Age': 4, 'Gender': 'Male', 'Name': 'Pepcoding'}" + ] + }, + "metadata": {}, + "execution_count": 20 + } + ] + }, + { + "cell_type": "code", + "source": [ + "" + ], + "metadata": { + "id": "tzYxJHlUjG3R" + }, + "execution_count": null, + "outputs": [] + } + ] +} \ No newline at end of file From aa2ab1293dacda9ad15d306851252d534ca6afcb Mon Sep 17 00:00:00 2001 From: Ritik Ramuka <56073559+ritikramuka@users.noreply.github.com> Date: Wed, 9 Feb 2022 16:28:30 +0530 Subject: [PATCH 32/41] Created using Colaboratory --- Python/Strings_English.ipynb | 176 ++++++++++++++++++++++++++++++----- 1 file changed, 151 insertions(+), 25 deletions(-) diff --git a/Python/Strings_English.ipynb b/Python/Strings_English.ipynb index 87b5118..77877f9 100644 --- a/Python/Strings_English.ipynb +++ b/Python/Strings_English.ipynb @@ -5,7 +5,7 @@ "colab": { "name": "Strings_English.ipynb", "provenance": [], - "authorship_tag": "ABX9TyOlgjQPywWhwT9tzwqC5VwQ", + "authorship_tag": "ABX9TyOH9s4e0tsAubaHAlMSabHg", "include_colab_link": true }, "kernelspec": { @@ -29,7 +29,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": { "id": "EbLqrwB1KKWA" }, @@ -50,7 +50,7 @@ "id": "p_UjJp1TK3G5", "outputId": "ac7504de-ac62-4fc3-f57c-6274cba88397" }, - "execution_count": 2, + "execution_count": null, "outputs": [ { "output_type": "stream", @@ -74,7 +74,7 @@ "id": "1oBR4DprK4t_", "outputId": "3c523644-2611-4868-c4a6-22accb5b8c0e" }, - "execution_count": 3, + "execution_count": null, "outputs": [ { "output_type": "error", @@ -102,7 +102,7 @@ "id": "R8kFYlFFK7pN", "outputId": "e7033f7b-9c91-4963-b2a7-d896ff17a9db" }, - "execution_count": 4, + "execution_count": null, "outputs": [ { "output_type": "execute_result", @@ -132,7 +132,7 @@ "id": "-NHVcJUcK_Ck", "outputId": "dff68f51-3edc-4961-c030-2f2c18e60399" }, - "execution_count": 5, + "execution_count": null, "outputs": [ { "output_type": "execute_result", @@ -162,7 +162,7 @@ "id": "5-2Xg7VULC5j", "outputId": "d0cb4540-e561-4d92-dc27-46b3d95bf311" }, - "execution_count": 6, + "execution_count": null, "outputs": [ { "output_type": "execute_result", @@ -192,7 +192,7 @@ "id": "WhWr9P4KLEDO", "outputId": "66d15478-ed2f-4817-e496-a166e2c40f9f" }, - "execution_count": 7, + "execution_count": null, "outputs": [ { "output_type": "execute_result", @@ -222,7 +222,7 @@ "id": "m967rZC6LGgh", "outputId": "498fd33d-583a-401c-e2fe-3923e94dde3d" }, - "execution_count": 8, + "execution_count": null, "outputs": [ { "output_type": "execute_result", @@ -252,7 +252,7 @@ "id": "i7db0_kGLJtj", "outputId": "0eb7608e-d935-4997-8d2a-ee53faa541e7" }, - "execution_count": 9, + "execution_count": null, "outputs": [ { "output_type": "execute_result", @@ -282,7 +282,7 @@ "id": "tr81HzIRLMvZ", "outputId": "f8563e9f-9cb6-4c72-a574-2ba9368a0972" }, - "execution_count": 10, + "execution_count": null, "outputs": [ { "output_type": "execute_result", @@ -312,7 +312,7 @@ "id": "6BHqQ7CgLP33", "outputId": "be0c4fce-60ee-426e-ecf1-a389f8199e31" }, - "execution_count": 11, + "execution_count": null, "outputs": [ { "output_type": "execute_result", @@ -342,7 +342,7 @@ "id": "E1ViE0e9LRFD", "outputId": "5054a431-b22d-49e7-977e-a2363802dc62" }, - "execution_count": 12, + "execution_count": null, "outputs": [ { "output_type": "execute_result", @@ -372,7 +372,7 @@ "id": "fUKskCauLiQO", "outputId": "eb94310b-e3b7-4f12-b7c2-517d782dfe64" }, - "execution_count": 13, + "execution_count": null, "outputs": [ { "output_type": "execute_result", @@ -401,7 +401,7 @@ "id": "HJ8DbiJULlTE", "outputId": "86741353-195d-473d-84f9-4c55e6ff3c65" }, - "execution_count": 14, + "execution_count": null, "outputs": [ { "output_type": "execute_result", @@ -428,7 +428,7 @@ "id": "odkTpuAZO620", "outputId": "d80434d2-0c03-47d3-bb13-9dff6130e74f" }, - "execution_count": 15, + "execution_count": null, "outputs": [ { "output_type": "execute_result", @@ -458,7 +458,7 @@ "id": "g6Xm8iRuPC6q", "outputId": "8c947834-23d8-476f-d3d5-2c023f4bfb90" }, - "execution_count": 16, + "execution_count": null, "outputs": [ { "output_type": "execute_result", @@ -488,7 +488,7 @@ "id": "qXhG10i9PHrt", "outputId": "7d4d41c9-e9e3-478c-b894-a81ed055620d" }, - "execution_count": 17, + "execution_count": null, "outputs": [ { "output_type": "stream", @@ -520,7 +520,7 @@ "id": "706bP1PlPKSj", "outputId": "2d3c760c-fc25-4e4a-8bcb-367c438b7415" }, - "execution_count": 18, + "execution_count": null, "outputs": [ { "output_type": "stream", @@ -534,6 +534,8 @@ { "cell_type": "code", "source": [ + "# upper case\n", + "\n", "phrase.upper()" ], "metadata": { @@ -544,7 +546,7 @@ "id": "WBfH1G3OPMbx", "outputId": "49040ae5-01dd-47f8-c029-8cb6afd7b21d" }, - "execution_count": 19, + "execution_count": null, "outputs": [ { "output_type": "execute_result", @@ -564,6 +566,8 @@ { "cell_type": "code", "source": [ + "# lower case\n", + "\n", "phrase.lower()" ], "metadata": { @@ -574,7 +578,7 @@ "id": "vs5oSYCPPQrn", "outputId": "47fa181a-b074-40af-d7b8-0c8fe35df6af" }, - "execution_count": 20, + "execution_count": null, "outputs": [ { "output_type": "execute_result", @@ -594,6 +598,8 @@ { "cell_type": "code", "source": [ + "# split\n", + "\n", "string = \"My name is Anthony Gonsalvis\"\n", "\n", "str2 = string.split(\" \")\n", @@ -604,9 +610,9 @@ "base_uri": "https://localhost:8080/" }, "id": "gSzoK_ZfPSa_", - "outputId": "2951b392-02fd-42b7-b5a8-dcfb90b57e4f" + "outputId": "14f84e18-4a24-4a14-af73-d5902f4cc91e" }, - "execution_count": 21, + "execution_count": 2, "outputs": [ { "output_type": "stream", @@ -629,7 +635,7 @@ "id": "Jstxly9iPVwG", "outputId": "600a5459-274a-4b51-dbae-0dd1835c42f3" }, - "execution_count": 22, + "execution_count": null, "outputs": [ { "output_type": "stream", @@ -640,13 +646,133 @@ } ] }, + { + "cell_type": "code", + "source": [ + "# replace\n", + "\n", + "string.replace(\"Anthony\", \"Ritik\")" + ], + "metadata": { + "id": "D-pY0T-hPZsq", + "outputId": "1fc8a744-5522-44be-b0c3-a1273fc4368c", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + } + }, + "execution_count": 4, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + }, + "text/plain": [ + "'My name is Ritik Gonsalvis'" + ] + }, + "metadata": {}, + "execution_count": 4 + } + ] + }, + { + "cell_type": "code", + "source": [ + "# Concatenation Of String\n", + "\n", + "str1 = \"Pep\"\n", + "str2 = \"Coding\"\n", + "print(\"String 1 : \", str1)\n", + "print(\"String 2 : \", str2)\n", + "str = str1 + str2\n", + "print(\"Concatenated two different strings : \",str)" + ], + "metadata": { + "id": "ZXQ3PjltkLkh", + "outputId": "626a7956-d841-4a4d-e0ce-b27199cab6c6", + "colab": { + "base_uri": "https://localhost:8080/" + } + }, + "execution_count": 5, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "String 1 : Pep\n", + "String 2 : Coding\n", + "Concatenated two different strings : PepCoding\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "# Format Keyword\n", + "\n", + "txt = \"Pepcoding\"\n", + "\n", + "print(txt + 3000)" + ], + "metadata": { + "id": "yOa32bRuHWNz", + "outputId": "b34cadf1-4a32-4dae-a0e3-556a62288591", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 224 + } + }, + "execution_count": 6, + "outputs": [ + { + "output_type": "error", + "ename": "TypeError", + "evalue": "ignored", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0mtxt\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m\"Pepcoding\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 3\u001b[0;31m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtxt\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0;36m3000\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 4\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtxt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mprice\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m300\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mTypeError\u001b[0m: can only concatenate str (not \"int\") to str" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "txt = \"Pepcoding have to create {price} lakh videos\"\n", + "print(txt.format(price = 3))" + ], + "metadata": { + "id": "U00qZpPLHiTZ", + "outputId": "04e552e5-df9a-4ce6-adf0-0657b974fec7", + "colab": { + "base_uri": "https://localhost:8080/" + } + }, + "execution_count": 15, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Pepcoding have to create 3 lakh videos\n" + ] + } + ] + }, { "cell_type": "code", "source": [ "" ], "metadata": { - "id": "D-pY0T-hPZsq" + "id": "2009i1k6ILsW" }, "execution_count": null, "outputs": [] From 0f165e694b584ffb5d3156564ccec4277d4ce110 Mon Sep 17 00:00:00 2001 From: ritik ramuka Date: Wed, 9 Feb 2022 16:35:32 +0530 Subject: [PATCH 33/41] updates --- Python/README.md | 28 ++++- Tuples_English.ipynb | 263 ------------------------------------------- 2 files changed, 24 insertions(+), 267 deletions(-) delete mode 100644 Tuples_English.ipynb diff --git a/Python/README.md b/Python/README.md index 86bdb0a..87e22eb 100644 --- a/Python/README.md +++ b/Python/README.md @@ -38,17 +38,32 @@ * Lists * What are Lists in Python * Implementing Lists in Python - * Basic operations on Lists * 2 + * Basic operations on Lists + * append + * insert + * remove + * pop + * Constructor Implementation * Tuples * What are Tuples in Python * Implementing Tuples in Python - * Basic operations on Tuples * 2 + * Basic operations on Tuples + * tuple object does not support item assignment + * tuple object does not append method + * Constructor Implementation * Sets * What are Sets in Python * Implementing Sets in Python - * Union in Sets - * Basics operations on Sets * 2 + * Basics operations on Sets + * set object is not subscriptable + * add + * remove + * pop + * clear + * del + * Union & Intersection in Sets * Updates in Sets Data Structure in new version of python + * Constructor Implementation * Packages in Python * Standard Library in Python * Global Variables @@ -68,6 +83,11 @@ * What is a dictionary? * Implementing a dictionary in Python. * Functions of dictionary + * pop + * keys + * values + * copy + * del * Recap of List, Sets, Tuples and Dictionary * Error Handling * Need of error handling diff --git a/Tuples_English.ipynb b/Tuples_English.ipynb deleted file mode 100644 index bec3b38..0000000 --- a/Tuples_English.ipynb +++ /dev/null @@ -1,263 +0,0 @@ -{ - "nbformat": 4, - "nbformat_minor": 0, - "metadata": { - "colab": { - "name": "Tuples_English.ipynb", - "provenance": [], - "authorship_tag": "ABX9TyOE1EAapAilILuxLR5IynC+", - "include_colab_link": true - }, - "kernelspec": { - "name": "python3", - "display_name": "Python 3" - }, - "language_info": { - "name": "python" - } - }, - "cells": [ - { - "cell_type": "markdown", - "metadata": { - "id": "view-in-github", - "colab_type": "text" - }, - "source": [ - "\"Open" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "id": "5DTge4jDbapb" - }, - "outputs": [], - "source": [ - "tup = (1, 2, 3, \"Hello\")" - ] - }, - { - "cell_type": "code", - "source": [ - "print(type(tup))" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "_MCtQYl8bhan", - "outputId": "98df2197-6a43-4a01-e8fa-1acc1ad1a1b6" - }, - "execution_count": 2, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "tup = 1, 2, 3, \"Hello\"" - ], - "metadata": { - "id": "LUgl5icUbjDD" - }, - "execution_count": 3, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "tup2 = (99, )" - ], - "metadata": { - "id": "vr2Vqa7jbkot" - }, - "execution_count": 4, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "print(type(tup2))" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "dUx78ZYLbmIJ", - "outputId": "9aee354b-2012-4d05-a973-0f098a397d34" - }, - "execution_count": 5, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "print(tup[0])" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "y1LCv7YLbsqd", - "outputId": "af9ae47d-cb03-4230-d1bf-dd933db84f71" - }, - "execution_count": 6, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "1\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "tup[0] = 5" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/", - "height": 158 - }, - "id": "OJlJUbTpbuiQ", - "outputId": "848284f6-b484-4f93-8de6-7d840e058583" - }, - "execution_count": 7, - "outputs": [ - { - "output_type": "error", - "ename": "TypeError", - "evalue": "ignored", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mtup\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m5\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;31mTypeError\u001b[0m: 'tuple' object does not support item assignment" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "for i in tup:\n", - " print(i)" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "HpU2QQIibwTM", - "outputId": "1dc19aff-9bab-4f44-ae5f-7e1959742527" - }, - "execution_count": 8, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "1\n", - "2\n", - "3\n", - "Hello\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "tup.append(5)" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/", - "height": 158 - }, - "id": "9isWLDECbzB3", - "outputId": "798f9102-b776-4b78-a48d-de419f9003bf" - }, - "execution_count": 9, - "outputs": [ - { - "output_type": "error", - "ename": "AttributeError", - "evalue": "ignored", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mtup\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m5\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;31mAttributeError\u001b[0m: 'tuple' object has no attribute 'append'" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "# contractor method\n", - "\n", - "tup3 = tuple((1, 2, 3))" - ], - "metadata": { - "id": "Ok5qVJ9Db1aL" - }, - "execution_count": 11, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "print(tup3)" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "_3Y8cImMb5mM", - "outputId": "da5e0303-b14b-4dea-8e98-638adf3c3730" - }, - "execution_count": 12, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "(1, 2, 3)\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "" - ], - "metadata": { - "id": "saBTMGdlb-rs" - }, - "execution_count": null, - "outputs": [] - } - ] -} \ No newline at end of file From cd2e3206662e549eb6ee14112055eac749b8b893 Mon Sep 17 00:00:00 2001 From: ritik ramuka Date: Wed, 9 Feb 2022 16:50:02 +0530 Subject: [PATCH 34/41] some updates in course overview --- Python/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Python/README.md b/Python/README.md index 87e22eb..4fceb0a 100644 --- a/Python/README.md +++ b/Python/README.md @@ -93,4 +93,5 @@ * Need of error handling * Protective Approach using if-else statement * Try and Except - * Pass Keyword + * finally + * raise From 192c848cfbb57ece046a05c08fa60aaa66075723 Mon Sep 17 00:00:00 2001 From: Ritik Ramuka <56073559+ritikramuka@users.noreply.github.com> Date: Wed, 9 Feb 2022 16:50:58 +0530 Subject: [PATCH 35/41] Try-Except in python code --- Python/Try_Except_English.ipynb | 193 ++++++++++++++++++++++++++++++++ 1 file changed, 193 insertions(+) create mode 100644 Python/Try_Except_English.ipynb diff --git a/Python/Try_Except_English.ipynb b/Python/Try_Except_English.ipynb new file mode 100644 index 0000000..c242d0d --- /dev/null +++ b/Python/Try_Except_English.ipynb @@ -0,0 +1,193 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "name": "Try-Except_English.ipynb", + "provenance": [], + "authorship_tag": "ABX9TyPoHURCLtgeGGfIKCOZyrVB", + "include_colab_link": true + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + } + }, + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "view-in-github", + "colab_type": "text" + }, + "source": [ + "\"Open" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 158 + }, + "id": "L_TWHoqkJ1bt", + "outputId": "f01bb5bf-268d-438e-ec1c-22e2b44e5b88" + }, + "outputs": [ + { + "output_type": "error", + "ename": "ZeroDivisionError", + "evalue": "ignored", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mZeroDivisionError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;36m5\u001b[0m\u001b[0;34m/\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mZeroDivisionError\u001b[0m: division by zero" + ] + } + ], + "source": [ + "5/0" + ] + }, + { + "cell_type": "code", + "source": [ + "a,b = 5,0\n", + "try:\n", + " test = \"Hello Peter Parker\"\n", + " print(pepcoding)\n", + "except ZeroDivisionError:\n", + " print(\"Division by zero happened\")\n", + "except NameError:\n", + " print(\"NameError Came\")\n", + "except:\n", + " print(\"Other Exception came\")\n", + "else:\n", + " print(\"Else Block Printed\")\n", + "\n", + "\n", + "print(\"Hello World\")" + ], + "metadata": { + "id": "s0sTbGIIMV4v" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "test = \"Hello Peter Parker\"\n", + "print(Pepcoding)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 175 + }, + "id": "ML4pnmghMbk6", + "outputId": "6c3b8782-6c30-49e7-8e81-52e4c588f14d" + }, + "execution_count": 2, + "outputs": [ + { + "output_type": "error", + "ename": "NameError", + "evalue": "ignored", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0mtest\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m\"Hello Peter Parker\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mPepcoding\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mNameError\u001b[0m: name 'Pepcoding' is not defined" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "a,b = 5,0\n", + "try:\n", + " test = \"Hello Peter Parker\"\n", + " print(pepcoding)\n", + "except ZeroDivisionError:\n", + " print(\"Division by zero happened\")\n", + "except NameError:\n", + " print(\"NameError Came\")\n", + "except:\n", + " print(\"Other Exception came\")\n", + "else:\n", + " print(\"Else Block Printed\")\n", + "finally:\n", + " print(\"Finally Block Printed\")\n", + "\n", + "\n", + "print(\"Hello World\")" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "BbAhZcDXMegt", + "outputId": "6e0860bc-2239-4a53-9d5f-34ffd562aef2" + }, + "execution_count": 3, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "NameError Came\n", + "Finally Block Printed\n", + "Hello World\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "raise Exception(\"List is empty\")" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 158 + }, + "id": "pd1pRWKEMhj4", + "outputId": "e7fc84b3-e746-4933-860e-31612c1c5ee3" + }, + "execution_count": 4, + "outputs": [ + { + "output_type": "error", + "ename": "Exception", + "evalue": "ignored", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mException\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mException\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"List is empty\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mException\u001b[0m: List is empty" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "" + ], + "metadata": { + "id": "dtwGpnqZMk7Z" + }, + "execution_count": null, + "outputs": [] + } + ] +} \ No newline at end of file From 268fb93dacf4bdf6310d236c4741a0c1d2af3fa8 Mon Sep 17 00:00:00 2001 From: Ritik Ramuka <56073559+ritikramuka@users.noreply.github.com> Date: Fri, 11 Feb 2022 10:57:57 +0530 Subject: [PATCH 36/41] functions in python code --- Python/Functions.ipynb | 79 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 Python/Functions.ipynb diff --git a/Python/Functions.ipynb b/Python/Functions.ipynb new file mode 100644 index 0000000..9628227 --- /dev/null +++ b/Python/Functions.ipynb @@ -0,0 +1,79 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "name": "Functions.ipynb", + "provenance": [], + "authorship_tag": "ABX9TyP7eO/fWZhb9DhZ/EMknfS7", + "include_colab_link": true + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + } + }, + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "view-in-github", + "colab_type": "text" + }, + "source": [ + "\"Open" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "Angz0noYPexM", + "outputId": "d9cb0b39-0d32-4e46-f0ef-115ed195d0d3" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "5\n", + "4\n", + "3\n", + "2\n", + "1\n", + "0\n" + ] + } + ], + "source": [ + "# print dec 5 - 0\n", + "\n", + "def pd(n) : \n", + " if n < 0 :\n", + " return\n", + " \n", + " print(n)\n", + " pd(n - 1)\n", + "\n", + "pd(5)" + ] + }, + { + "cell_type": "code", + "source": [ + "" + ], + "metadata": { + "id": "QPPdwXV1Pw0M" + }, + "execution_count": null, + "outputs": [] + } + ] +} \ No newline at end of file From bbb38c55a317aa1ebbcb9c40232c34bf3b64096c Mon Sep 17 00:00:00 2001 From: Ritik Ramuka <56073559+ritikramuka@users.noreply.github.com> Date: Fri, 11 Feb 2022 11:27:28 +0530 Subject: [PATCH 37/41] lambda functions in python --- Python/Functions_Advanced_English.ipynb | 102 ++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 Python/Functions_Advanced_English.ipynb diff --git a/Python/Functions_Advanced_English.ipynb b/Python/Functions_Advanced_English.ipynb new file mode 100644 index 0000000..a16c606 --- /dev/null +++ b/Python/Functions_Advanced_English.ipynb @@ -0,0 +1,102 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "name": "Functions_Advanced_English.ipynb", + "provenance": [], + "authorship_tag": "ABX9TyP1JxDzTiFDMpsL+bYY8CWG", + "include_colab_link": true + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + } + }, + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "view-in-github", + "colab_type": "text" + }, + "source": [ + "\"Open" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "sBjrT3cPVTjt", + "outputId": "23863919-b98c-4ad3-a8df-e92724d20099" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "60\n" + ] + } + ], + "source": [ + "# lambda func\n", + "\n", + "\n", + "x = lambda a,b,c : a*b*c\n", + "\n", + "c = x(10,3,2)\n", + "print(c)" + ] + }, + { + "cell_type": "code", + "source": [ + "def f(a) :\n", + " return lambda n : n*a\n", + "\n", + "c = f(10)\n", + "print(c)\n", + "\n", + "d = c(9)\n", + "print(d)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "RPEzC21KVigR", + "outputId": "e08d21e2-3e75-4b42-bd38-51a9a2a6505a" + }, + "execution_count": 3, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + ". at 0x7f7ecbc45440>\n", + "90\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "" + ], + "metadata": { + "id": "oxLU40dcVndS" + }, + "execution_count": null, + "outputs": [] + } + ] +} \ No newline at end of file From 2106fb8130977fabc94ca92e4b3563a8518382dd Mon Sep 17 00:00:00 2001 From: Ritik Ramuka <56073559+ritikramuka@users.noreply.github.com> Date: Fri, 11 Feb 2022 11:40:22 +0530 Subject: [PATCH 38/41] Global Variables in python --- Python/GlobalVariables_English.ipynb | 72 ++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 Python/GlobalVariables_English.ipynb diff --git a/Python/GlobalVariables_English.ipynb b/Python/GlobalVariables_English.ipynb new file mode 100644 index 0000000..ca56c4b --- /dev/null +++ b/Python/GlobalVariables_English.ipynb @@ -0,0 +1,72 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "name": "GlobalVariables_English.ipynb", + "provenance": [], + "authorship_tag": "ABX9TyN9k2yaUuWN5TBUPNwqtsYi", + "include_colab_link": true + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + } + }, + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "view-in-github", + "colab_type": "text" + }, + "source": [ + "\"Open" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "tKYHGOEKXseC", + "outputId": "47d6a2ba-ad47-4cc2-edc1-81bf447e4682" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "10\n", + "10\n" + ] + } + ], + "source": [ + "global r\n", + "r = 10\n", + "def fun() :\n", + " # r = 10\n", + " print(r)\n", + "fun()\n", + "print(r)" + ] + }, + { + "cell_type": "code", + "source": [ + "" + ], + "metadata": { + "id": "i34LP2biZnUo" + }, + "execution_count": null, + "outputs": [] + } + ] +} \ No newline at end of file From 91de8d3933ff8322f16f91324d4cd4fd637d66f2 Mon Sep 17 00:00:00 2001 From: Ritik Ramuka <56073559+ritikramuka@users.noreply.github.com> Date: Fri, 18 Feb 2022 23:13:54 +0530 Subject: [PATCH 39/41] Update README.md --- Python/README.md | 171 +++++++++++++++++++++++------------------------ 1 file changed, 84 insertions(+), 87 deletions(-) diff --git a/Python/README.md b/Python/README.md index 4fceb0a..c3ab86b 100644 --- a/Python/README.md +++ b/Python/README.md @@ -2,96 +2,93 @@ ## Introduction -* Python -* Why Python for Data Science -* Setting up Environment - * Google Colab - * Jupyter Notebook +- [x] Python +- [x] Why Python for Data Science +- [x] Setting up Environment + - [x] Google Colab + - [x] Jupyter Notebook ## Basics -* Why we need variables | Types of variables -* I/O in Python -* Why we need operators | Types of operators -* Conditional Operators - * If-Else Statement -* Why we need loops -* Loops - * While loop - * Basics - * continue and break keywords - * While Else - * For loop - * Range Method - * For Else - * Do While loop - * Basic - * Difference between entry controlled and exit controlled loop -* Code Indentation in Python -* Why do we need functions? -* Implementing basic functions +- [x] Why we need variables | Types of variables +- [x] I/O in Python +- [ ] Why we need operators | Types of operators +- [x] Conditional Operators + - [x] If-Else Statement +- [x] Why we need loops +- [x] Loops + - [x] While loop + - [x] Basics + - [x] continue and break keywords + - [x] While Else + - [x] For loop + - [x] Range Method + - [x] For Else +- [ ] Code Indentation in Python +- [ ] Why do we need functions? +- [ ] Implementing basic functions ## Fundamentals Of Python -* What are Arrays? -* Implementing Arrays in Python -* Lists - * What are Lists in Python - * Implementing Lists in Python - * Basic operations on Lists - * append - * insert - * remove - * pop - * Constructor Implementation -* Tuples - * What are Tuples in Python - * Implementing Tuples in Python - * Basic operations on Tuples - * tuple object does not support item assignment - * tuple object does not append method - * Constructor Implementation -* Sets - * What are Sets in Python - * Implementing Sets in Python - * Basics operations on Sets - * set object is not subscriptable - * add - * remove - * pop - * clear - * del - * Union & Intersection in Sets - * Updates in Sets Data Structure in new version of python - * Constructor Implementation -* Packages in Python -* Standard Library in Python -* Global Variables -* Casting in python specific data type -* Strings - * Slicing - * Standard string modifiers - * Upper, lower - * Replace, Split - * Concatenation of String - * What happens when concat string and number - * Format function -* Advanced Functions - * Lambda Functions - * Basics functions containing lambda functions -* Dictionary - * What is a dictionary? - * Implementing a dictionary in Python. - * Functions of dictionary - * pop - * keys - * values - * copy - * del -* Recap of List, Sets, Tuples and Dictionary -* Error Handling - * Need of error handling - * Protective Approach using if-else statement - * Try and Except - * finally - * raise +- [ ] What are Arrays? +- [ ] Implementing Arrays in Python +- [ ] Lists + - [ ] What are Lists in Python + - [ ] Implementing Lists in Python + - [ ] Basic operations on Lists + - [ ] append + - [ ] insert + - [ ] remove + - [ ] pop + - [ ] Constructor Implementation +- [ ] Tuples + - [ ] What are Tuples in Python + - [ ] Implementing Tuples in Python + - [ ] Basic operations on Tuples + - [ ] tuple object does not support item assignment + - [ ] tuple object does not append method + - [ ] Constructor Implementation +- [ ] Sets + - [ ] What are Sets in Python + - [ ] Implementing Sets in Python + - [ ] Basics operations on Sets + - [ ] set object is not subscriptable + - [ ] add + - [ ] remove + - [ ] pop + - [ ] clear + - [ ] del + - [ ] Union & Intersection in Sets + - [ ] Updates in Sets Data Structure in new version of python + - [ ] Constructor Implementation +- [ ] Packages in Python +- [ ] Standard Library in Python +- [ ] Global Variables +- [ ] Casting in python specific data type +- [ ] Strings + - [ ] Slicing + - [ ] Standard string modifiers + - [ ] Upper, lower + - [ ] Replace, Split + - [ ] Concatenation of String + - [ ] What happens when concat string and number + - [ ] Format function +- [ ] Advanced Functions + - [ ] Lambda Functions + - [ ] Basics functions containing lambda functions +- [ ] Dictionary + - [ ] What is a dictionary? + - [ ] Implementing a dictionary in Python. + - [ ] Functions of dictionary + - [ ] pop + - [ ] keys + - [ ] values + - [ ] copy + - [ ] del +- [ ] Recap of List, Sets, Tuples and Dictionary +- [ ] Error Handling + - [ ] Need of error handling + - [ ] Protective Approach using if-else statement + - [ ] Try and Except + - [ ] finally + - [ ] raise From 894bc149a55d9e688db807d7c9670807a144f084 Mon Sep 17 00:00:00 2001 From: Ritik Ramuka <56073559+ritikramuka@users.noreply.github.com> Date: Tue, 22 Feb 2022 12:29:35 +0530 Subject: [PATCH 40/41] Update README.md --- Python/README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Python/README.md b/Python/README.md index c3ab86b..7f18b92 100644 --- a/Python/README.md +++ b/Python/README.md @@ -24,7 +24,7 @@ - [x] For loop - [x] Range Method - [x] For Else -- [ ] Code Indentation in Python +- [x] Code Indentation in Python - [ ] Why do we need functions? - [ ] Implementing basic functions @@ -32,15 +32,15 @@ - [ ] What are Arrays? - [ ] Implementing Arrays in Python -- [ ] Lists - - [ ] What are Lists in Python - - [ ] Implementing Lists in Python - - [ ] Basic operations on Lists - - [ ] append - - [ ] insert - - [ ] remove - - [ ] pop - - [ ] Constructor Implementation +- [x] Lists + - [x] What are Lists in Python + - [x] Implementing Lists in Python + - [x] Basic operations on Lists + - [x] append + - [x] insert + - [x] remove + - [x] pop + - [x] Constructor Implementation - [ ] Tuples - [ ] What are Tuples in Python - [ ] Implementing Tuples in Python From 29eb6d8a437ebe4810d8bda9e919e436695d7d92 Mon Sep 17 00:00:00 2001 From: Ritik Ramuka <56073559+ritikramuka@users.noreply.github.com> Date: Fri, 25 Feb 2022 11:04:15 +0530 Subject: [PATCH 41/41] Update README.md --- Python/README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Python/README.md b/Python/README.md index 7f18b92..eee5031 100644 --- a/Python/README.md +++ b/Python/README.md @@ -41,16 +41,16 @@ - [x] remove - [x] pop - [x] Constructor Implementation -- [ ] Tuples - - [ ] What are Tuples in Python - - [ ] Implementing Tuples in Python - - [ ] Basic operations on Tuples - - [ ] tuple object does not support item assignment - - [ ] tuple object does not append method - - [ ] Constructor Implementation -- [ ] Sets - - [ ] What are Sets in Python - - [ ] Implementing Sets in Python +- [x] Tuples + - [x] What are Tuples in Python + - [x] Implementing Tuples in Python + - [x] Basic operations on Tuples + - [x] tuple object does not support item assignment + - [x] tuple object does not append method + - [x] Constructor Implementation +- [x] Sets + - [x] What are Sets in Python + - [x] Implementing Sets in Python - [ ] Basics operations on Sets - [ ] set object is not subscriptable - [ ] add