diff --git a/Data Type.ipynb b/Data Type.ipynb index 84d7819..4a0f321 100644 --- a/Data Type.ipynb +++ b/Data Type.ipynb @@ -49,7 +49,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 1, "metadata": {}, "outputs": [ { @@ -58,7 +58,7 @@ "0.5" ] }, - "execution_count": 3, + "execution_count": 1, "metadata": {}, "output_type": "execute_result" } diff --git a/If-Else.ipynb b/If-Else.ipynb index 0ff6130..09b4d08 100644 --- a/If-Else.ipynb +++ b/If-Else.ipynb @@ -77,10 +77,7 @@ } ], "source": [ - "if 1 > 2:\n", - " print('first')\n", - "else:\n", - " print('last')" + "p" ] }, { diff --git a/List.ipynb b/List.ipynb index b093b36..7015b01 100644 --- a/List.ipynb +++ b/List.ipynb @@ -9,45 +9,82 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1, 2, 3, 4, 5, 5, 6, 78, 88, 9]\n" + ] + } + ], "source": [ - "[1,2,3]" + "a=[1,2,3,4,5,5,6,78,88,9]\n", + "print(a)" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "['hi', 1, [1, 2]]" + "['hi', 1]" ] }, - "execution_count": 2, + "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "['hi',1,[1,2]]" + "['hi',1]" ] }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 5, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['a', 'b', 'c', 10]\n", + "['a', 'b', 'c', 10, 'Angshuman']\n", + "['a', 'b', 'c', 10, 'Angshuman', 'aaaaa']\n", + "['a', 'b', 'c', 10, 'Angshuman', 'aaaaa', 'bbb']\n", + "['a', 'b', 'c', 10, 'Angshuman', 'aaaaa', 'bbb', 'uuu']\n", + "['a', 'b', 'c', 10, 'Angshuman', 'aaaaa', 'bbb', 'uuu', 'nnn']\n", + "['a', 'b', 'c', 10, 'Angshuman', 'aaaaa', 'bbb', 'uuu', 'nnn', 'f']\n" + ] + } + ], "source": [ - "my_list = ['a','b','c',10]" + "my_list = ['a','b','c',10]\n", + "print(my_list)\n", + "\n", + "my_list.append(\"Angshuman\")\n", + "print(my_list)\n", + "my_list.append('aaaaa')\n", + "print(my_list)\n", + "my_list.append('bbb')\n", + "print(my_list)\n", + "my_list.append('uuu')\n", + "print(my_list)\n", + "my_list.append('nnn')\n", + "print(my_list)\n", + "my_list.append('f')\n", + "print(my_list)\n" ] }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 5, "metadata": {}, "outputs": [], "source": [ @@ -56,107 +93,115 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "['a', 'b', 'c', 10, 'd']" + "10" ] }, - "execution_count": 5, + "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "my_list" + "my_list[3]" ] }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "10" + "[1, 2, 3, 4, 5, 6, 7]" ] }, - "execution_count": 6, + "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "my_list[3]" + "p=[1,2,3,4,5,6,7]\n", + "p" ] }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 12, "metadata": {}, "outputs": [ { - "data": { - "text/plain": [ - "'b'" - ] - }, - "execution_count": 7, - "metadata": {}, - "output_type": "execute_result" + "name": "stdout", + "output_type": "stream", + "text": [ + "[1, 2, 3, 4, 5, 6, 7, 1000]\n" + ] } ], "source": [ - "my_list[1]" + "\n", + "p.append(1000)\n", + "print(p)" ] }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 14, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "['b', 'c', 10, 'd']" + "['b', 'c', 10, 'Angshuman', 'aaaaa', 'bbb']" ] }, - "execution_count": 8, + "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "my_list[1:]" + "my_list[1:7]\n", + "\n" ] }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 15, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "['a']" + "'f'" ] }, - "execution_count": 9, + "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "my_list[:1]" + "my_list[-1]\n" ] }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 22, "metadata": {}, "outputs": [], "source": [ @@ -165,16 +210,16 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 23, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "['NEW', 'b', 'c', 10, 'd']" + "['NEW', 'b', 'c', 10, 'aaaaa', 'bbb', 'uuu', 'nnn', 'fff']" ] }, - "execution_count": 12, + "execution_count": 23, "metadata": {}, "output_type": "execute_result" } @@ -185,25 +230,53 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 25, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "11\n", + "22\n", + "33\n", + "[44, 55, [66, 77, 88]]\n", + "44\n", + "55\n", + "[66, 77, 88]\n", + "66\n", + "77\n", + "88\n" + ] + } + ], "source": [ - "nest = [1,2,3,[4,5,['target','PYTHON']]]" + "nest = [11,22,33,[44,55,[66,77,88]]]\n", + "\n", + "print(nest[0])\n", + "print(nest[1])\n", + "print(nest[2])\n", + "print(nest[3])\n", + "print(nest[3][0])\n", + "print(nest[3][1])\n", + "print(nest[3][2])\n", + "print(nest[3][2][0])\n", + "print(nest[3][2][1])\n", + "print(nest[3][2][2])" ] }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 25, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "[4, 5, ['target', 'PYTHON']]" + "[4, 5]" ] }, - "execution_count": 14, + "execution_count": 25, "metadata": {}, "output_type": "execute_result" } @@ -254,22 +327,27 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 43, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "['A', 'B', 'C']\n", - "['A', 'C']\n" + "['AAA', 'B', 'C', 'AAA']\n", + "['B', 'C', 'AAA']\n", + "['B', 'C']\n" ] } ], "source": [ - "thislist = [\"A\", \"B\", \"C\"]\n", + "thislist = [\"AAA\", \"B\", \"C\",\"AAA\"]\n", "print(thislist)\n", - "thislist.remove(\"B\")\n", + "thislist.remove(\"AAA\")\n", + "print(thislist)\n", + "\n", + "del thislist[2]\n", + "\n", "print(thislist)" ] }, @@ -294,17 +372,26 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 33, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['apple', 'banana']\n" + ] + } + ], "source": [ "thislist = [\"apple\", \"banana\", \"cherry\"]\n", - "del thislist" + "del thislist[2]\n", + "print(thislist)" ] }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 27, "metadata": {}, "outputs": [ { @@ -342,7 +429,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 47, "metadata": {}, "outputs": [ { @@ -361,7 +448,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 34, "metadata": {}, "outputs": [ { @@ -405,19 +492,19 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 50, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "['a', 'b', 'c', 1, 2, 3]\n" + "['a', 'b', 'c', 1, 1, 2, 3]\n" ] } ], "source": [ - "list1 = [\"a\", \"b\" , \"c\"]\n", + "list1 = [\"a\", \"b\" , \"c\",1]\n", "list2 = [1, 2, 3]\n", "\n", "list1.extend(list2)\n", @@ -426,20 +513,34 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 38, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "['apple', 'banana']\n" + "apple\n", + "cherry\n", + "Hi\n", + "Hello\n", + "Stack\n", + "banana\n", + "[]\n" ] } ], "source": [ "thislist = [\"apple\", \"banana\", \"cherry\"]\n", - "thislist.pop()\n", + "thislist.append(\"Hello\")\n", + "thislist.pop(0)\n", + "print(thislist.pop(1))\n", + "thislist.append(\"Hi\")\n", + "print(thislist.pop())\n", + "print(thislist.pop())\n", + "thislist.append(\"Stack\")\n", + "print(thislist.pop())\n", + "print(thislist.pop())\n", "print(thislist)" ] } diff --git a/Loops.ipynb b/Loops.ipynb index c7879a8..00f1ec1 100644 --- a/Loops.ipynb +++ b/Loops.ipynb @@ -9,46 +9,41 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ - "seq = [1,2,3,4,5]" + "seq = [1,2]" ] }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "1\n", - "2\n", - "3\n", - "4\n", - "5\n" + "1 Hello\n", + "2 Hello\n" ] } ], "source": [ - "for item in seq:\n", - " print(item)" + "for i in seq:\n", + " print(str(i)+\" Hello\")" ] }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Yep\n", - "Yep\n", "Yep\n", "Yep\n", "Yep\n" @@ -62,52 +57,44 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 17, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "2\n", - "4\n", - "6\n", - "8\n", - "10\n" + "1 Hello\n", + "2 Hello\n", + "1 Hello\n", + "2 Hello\n" ] } ], "source": [ "for jelly in seq:\n", - " print(jelly+jelly)" + " for i in seq:\n", + " print(str(i)+\" Hello\")" ] }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 14, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "i is: 1\n", - "i is: 1\n", - "i is: 2\n", - "i is: 2\n", - "i is: 3\n", - "i is: 3\n", - "i is: 4\n", - "i is: 4\n" + "i is: --- 4 \n" ] } ], "source": [ - "i = 1\n", + "i = 4\n", "while i < 5:\n", - " print('i is: {}'.format(i))\n", - " print(\"i is: \"+str(i))\n", - " i = i+1" + " print('i is: --- {} '.format(i))\n", + " i=i+1" ] }, { @@ -132,14 +119,13 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "0\n", "1\n", "2\n", "3\n", @@ -148,7 +134,7 @@ } ], "source": [ - "for i in range(5):\n", + "for i in range(1,5):\n", " print(i)" ] }, diff --git a/Sets.ipynb b/Sets.ipynb index cb53a42..ee12881 100644 --- a/Sets.ipynb +++ b/Sets.ipynb @@ -29,48 +29,49 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "{1, 2, 3}" + "{1, 2, 3, 12}" ] }, - "execution_count": 2, + "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "{1,2,3,1,2,1,2,3,3,3,3,2,2,2,1,1,2}" + "{1,2,3,1,2,1,2,3,3,3,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,12,2,2,1,1,2}" ] }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "{'banana', 'orange', 'mango', 'cherry', 'grapes', 'apple'}\n" + "{'apple', 'cherry', 'banana'}\n", + "{'mango', 'grapes', 'banana', 'cherry', 'apple', 'orange'}\n" ] } ], "source": [ "thisset = {\"apple\", \"banana\", \"cherry\"}\n", - "\n", - "thisset.update([\"orange\", \"mango\", \"grapes\"])\n", + "print(thisset)\n", + "thisset.update([ \"grapes\",\"orange\", \"mango\",\"banana\",\"apple\", \"banana\", \"cherry\"])\n", "\n", "print(thisset)" ] }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 6, "metadata": {}, "outputs": [ { @@ -82,7 +83,7 @@ } ], "source": [ - "p=(1,2,3,1,2,1,2,3,3,3,3,2,2,2,1,1,1)\n", + "p=[1,2,3,1,2,1,2,3,3,3,3,2,2,2,1,1,1]\n", "s=set(p)\n", "print(s)" ] diff --git a/String.ipynb b/String.ipynb index 51689fc..e42a7e6 100644 --- a/String.ipynb +++ b/String.ipynb @@ -2,18 +2,16 @@ "cells": [ { "cell_type": "code", - "execution_count": 2, + "execution_count": 3, "metadata": {}, "outputs": [ { - "data": { - "text/plain": [ - "'single quotes'" - ] - }, - "execution_count": 2, - "metadata": {}, - "output_type": "execute_result" + "ename": "SyntaxError", + "evalue": "EOF while scanning triple-quoted string literal (, line 1)", + "output_type": "error", + "traceback": [ + "\u001b[1;36m File \u001b[1;32m\"\"\u001b[1;36m, line \u001b[1;32m1\u001b[0m\n\u001b[1;33m 'single qu''''otes'\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m EOF while scanning triple-quoted string literal\n" + ] } ], "source": [ @@ -22,27 +20,32 @@ }, { "cell_type": "code", - "execution_count": 3, - "metadata": {}, + "execution_count": 4, + "metadata": { + "collapsed": true, + "jupyter": { + "outputs_hidden": true + } + }, "outputs": [ { "data": { "text/plain": [ - "'double quotes'" + "\"double quo''''''''tes\"" ] }, - "execution_count": 3, + "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "\"double quotes\"" + "\"double quo''''''''tes\"" ] }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 5, "metadata": {}, "outputs": [ { @@ -51,7 +54,7 @@ "\" wrap lot's of other quotes\"" ] }, - "execution_count": 4, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } @@ -62,220 +65,250 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 14, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "H\n" + "!dlroW ,olleH\n" ] } ], "source": [ "a = \"Hello, World!\"\n", - "print(a[0])" + "print(a[::-1])" ] }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 15, "metadata": {}, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "umyadip\n" + "ename": "SyntaxError", + "evalue": "invalid syntax (, line 2)", + "output_type": "error", + "traceback": [ + "\u001b[1;36m File \u001b[1;32m\"\"\u001b[1;36m, line \u001b[1;32m2\u001b[0m\n\u001b[1;33m for i in range(len(str)+1:: -1):\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n" ] } ], "source": [ - "b =\"Soumyadip\"\n", - "print(b[2:])" + "str =\"P y t h o n J A V A C++\"\n", + "l=\n" ] }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 11, "metadata": {}, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "54321\n" - ] + "data": { + "text/plain": [ + "'uDivyanshu'" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ - "b = \"6543210\"\n", - "print(b[-6:-1])" + "a=\"Divyanshu\"\n", + "a=a[8]+a[0:]\n", + "a" ] }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 25, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "6" + ] + }, + "execution_count": 25, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "a = \"Dutipr\"\n", + "len(a)" + ] + }, + { + "cell_type": "code", + "execution_count": 28, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "13\n" + "Krishna\n" ] } ], "source": [ - "a = \"Hello, World!\"\n", - "print(len(a))" + "b = \"Krishna\"\n", + "print(b[-7:100])" ] }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 32, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Hello, World!\n" + "Hello, World!\n" ] } ], "source": [ - "a = \" Hello, World! \"\n", + "a = \" Hello, World! \"\n", "print(a.strip()) #Remove Space" ] }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 37, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "hello, world!\n", - "Hello, World!\n", + "HELLO, World!\n", + "HELLO, WORLD!\n", + "HELLO, World!\n", "hello, world!\n" ] } ], "source": [ - "a = \"Hello, World!\"\n", - "print(a.lower())\n", + "a = \"HELLO, World!\"\n", + "print(a)\n", + "print(a.upper())\n", "print(a)\n", "a=a.lower()\n", - "print(a)" + "print(a)\n" ] }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Jello, World!\n", - "Hello, World!\n" + "HeDhritimano, World!\n", + "Hello, World!\n", + "Jello, World!\n" ] } ], "source": [ "a = \"Hello, World!\"\n", - "print(a.replace(\"H\", \"J\"))\n", + "print(a.replace(\"ll\", \"Dhritiman\"))\n", + "print(a)\n", + "a=a.replace(\"H\", \"J\")\n", "print(a)" ] }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 59, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "['Hello', ' World!']\n", - "['Hello', ' World!']\n" + "['', 'C']\n" ] } ], "source": [ - "a = \"Hello, World!\"\n", - "print(a.split(\",\"))\n", - "l=a.split(\",\")\n", - "print(l)" + "a = \"ABC\"\n", + "print(a.split(\"AB\"))" ] }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 61, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "True\n" + "False\n" ] } ], "source": [ "txt = \"The rain in Spain stays mainly in the plain\"\n", - "x = \"ain\" in txt\n", + "x = \"Speutrwyhejwjq3w4jhjain\" in txt\n", "print(x)" ] }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 71, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "10 Python \n" + "Python 10\n" ] } ], "source": [ "a=10\n", "b=\"Python\"\n", - "c=\"{} {} \"\n", - "print(c.format(a,b))" + "c=\"{} {}\"\n", + "print(c.format(b,a,a,a,a,a,a,a))\n" ] }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 96, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Python 10 \n" + " 333 443 233 133 \n" ] } ], "source": [ - "a=10\n", - "b=\"Python\"\n", - "c=\"{1} {0} \"\n", - "print(c.format(a,b))" + "a=133\n", + "b=\"233\"\n", + "d=\"333\"\n", + "e=\"443\"\n", + "c=\" {1} {0} {3} {2} \"\n", + "print(c.format(a,b,e,d))\n" ] }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 58, "metadata": {}, "outputs": [ { @@ -287,7 +320,7 @@ } ], "source": [ - "a=10\n", + "\n", "b=\"Python\"\n", "c=\"{p} {q} \"\n", "print(c.format(p=a,q=b))" @@ -295,16 +328,16 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 74, "metadata": {}, "outputs": [], "source": [ - "st = 'hello # my name is # Soumyadip'" + "yt = 'hello # my name is # Soumyadip'" ] }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 70, "metadata": {}, "outputs": [ { @@ -313,13 +346,13 @@ "['hello ', ' my name is ', ' Soumyadip']" ] }, - "execution_count": 24, + "execution_count": 70, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "st.split('#')" + " tr.split('#')" ] }, { @@ -339,12 +372,12 @@ } ], "source": [ - "st.split('#')[1]" + "tr.split('#')[1]" ] }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 73, "metadata": {}, "outputs": [ { @@ -353,13 +386,13 @@ "True" ] }, - "execution_count": 27, + "execution_count": 73, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "'Soumyadip' in st" + "'Soumyadip' in yt" ] } ], diff --git a/Tuples.ipynb b/Tuples.ipynb index 65d8623..c78bf58 100644 --- a/Tuples.ipynb +++ b/Tuples.ipynb @@ -79,7 +79,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 1, "metadata": {}, "outputs": [ { @@ -96,7 +96,7 @@ "source": [ "thistuple = (\"apple\", \"banana\", \"cherry\")\n", "print(thistuple[-1])\n", - "print(thistuple[-0])\n", + "print(thistuple[0])\n", "print(thistuple[-2])\n", "print(thistuple[-3])" ] @@ -107,63 +107,64 @@ "metadata": {}, "outputs": [], "source": [ - "thistuple = (\"apple\", \"banana\", \"cherry\")" + "tgyfdfxrdectrs = (\"apple\", \"banana\", \"cherry\")" ] }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "('cherry', 'orange', 'kiwi')\n" + "('banana', 'cherry', 'orange', 'kiwi', 'melon')\n" ] } ], "source": [ "thistuple = (\"apple\", \"banana\", \"cherry\", \"orange\", \"kiwi\", \"melon\", \"mango\")\n", - "print(thistuple[2:5])" + "print(thistuple[1:6])" ] }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 7, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "('cherry', 'orange', 'kiwi')\n" + "()\n" ] } ], "source": [ "thistuple = (\"apple\", \"banana\", \"cherry\", \"orange\", \"kiwi\", \"melon\", \"mango\")\n", - "print(thistuple[2:5])" + "print(thistuple[:-7])" ] }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 9, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "['apple', 'kiwi', 'cherry']\n", - "('apple', 'kiwi', 'cherry')\n" + "['apple', 'kiwi', 'banana', 'cherry']\n", + "('apple', 'kiwi', 'banana', 'cherry')\n" ] } ], "source": [ "x = (\"apple\", \"banana\", \"cherry\")\n", "y = list(x)\n", - "y[1] = \"kiwi\"\n", + "\n", + "y.insert(1,\"kiwi\")\n", "x = tuple(y)\n", "\n", "print(y)\n", @@ -212,12 +213,25 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 3, "metadata": {}, - "outputs": [], + "outputs": [ + { + "ename": "NameError", + "evalue": "name 'thistuple' is not defined", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[0mthistuple\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;33m(\u001b[0m\u001b[1;34m\"apple\"\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m\"banana\"\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m\"cherry\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2\u001b[0m \u001b[1;32mdel\u001b[0m \u001b[0mthistuple\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 3\u001b[1;33m \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mthistuple\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mNameError\u001b[0m: name 'thistuple' is not defined" + ] + } + ], "source": [ "thistuple = (\"apple\", \"banana\", \"cherry\")\n", - "del thistuple" + "del thistuple\n", + "print(thistuple)" ] }, { diff --git a/Untitled1.ipynb b/Untitled1.ipynb new file mode 100644 index 0000000..11e9b45 --- /dev/null +++ b/Untitled1.ipynb @@ -0,0 +1,395 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello world\n" + ] + } + ], + "source": [ + "print(\"Hello world\")" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "2" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "1+1" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "4" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "1*4" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "4.0" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "8/2" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "4" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "8//2" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "1" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "9%2" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "4194304" + ] + }, + "execution_count": 1, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "2**22" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "45" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "(2+3)*(9+0)" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "True" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "False" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "1>2" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "1<2" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "1==1" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "10" + ] + }, + "execution_count": 27, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "i=10\n", + "i" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "-1000" + ] + }, + "execution_count": 33, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "a=-1000\n", + "a" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "metadata": {}, + "outputs": [], + "source": [ + "z=10" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 36, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "10" + ] + }, + "execution_count": 36, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "z" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.4" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/Untitled2.ipynb b/Untitled2.ipynb new file mode 100644 index 0000000..9be32df --- /dev/null +++ b/Untitled2.ipynb @@ -0,0 +1,183 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "10" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "i=10\n", + "i" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "a=10" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0\n", + "\n" + ] + } + ], + "source": [ + "a=-10\n", + "b=10.1\n", + "c=int(a+b) #Typecasting\n", + "print(c)\n", + "print(type(c))" + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'aaaaa'" + ] + }, + "execution_count": 46, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "str=\"aaaaa\"\n", + "str" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hi\n" + ] + } + ], + "source": [ + "if 1>2 :\n", + " print(\"Hello\")\n", + "elif 1==1:\n", + " print(\"Hi\")\n", + "else:\n", + " print(\"World\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.4" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/Untitled3.ipynb b/Untitled3.ipynb new file mode 100644 index 0000000..d2e759c --- /dev/null +++ b/Untitled3.ipynb @@ -0,0 +1,248 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello World\n" + ] + } + ], + "source": [ + "print(\"Hello World\")" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "2" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "1+1" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0\n" + ] + } + ], + "source": [ + "print(1-1)" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "4.5" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "9/2" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "4" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "9//2" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "1" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "9%2" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "8" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "2**3" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "True" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "False" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "1<2" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "20\n", + "\n" + ] + } + ], + "source": [ + "a=10\n", + "b=10.1\n", + "c=int(a+b)\n", + "print(c)\n", + "print(type(c))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.4" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/Untitled4.ipynb b/Untitled4.ipynb new file mode 100644 index 0000000..f98dc2b --- /dev/null +++ b/Untitled4.ipynb @@ -0,0 +1,138 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "10\n" + ] + } + ], + "source": [ + "a=10\n", + "a\n", + "print(a)\n", + "a\n", + "b=9" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n" + ] + } + ], + "source": [ + "print(type(a))\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n" + ] + }, + { + "data": { + "text/plain": [ + "'Hello World'" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s=\"Hello World\"\n", + "s\n", + "print(type(s))\n", + "s" + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hi\n" + ] + } + ], + "source": [ + "if 1>2 : \n", + " print(\"Hello\") \n", + " print(\"Hello\")\n", + " print(\"Hello\") \n", + "elif 1==1 :\n", + " print(\"Hi\")\n", + "else : \n", + " print(\"World\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.4" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +}