|
2 | 2 | "cells": [ |
3 | 3 | { |
4 | 4 | "cell_type": "code", |
5 | | - "execution_count": 4, |
| 5 | + "execution_count": 3, |
6 | 6 | "metadata": {}, |
7 | 7 | "outputs": [ |
8 | 8 | { |
9 | | - "data": { |
10 | | - "text/plain": [ |
11 | | - "'single quotes'" |
12 | | - ] |
13 | | - }, |
14 | | - "execution_count": 4, |
15 | | - "metadata": {}, |
16 | | - "output_type": "execute_result" |
| 9 | + "ename": "SyntaxError", |
| 10 | + "evalue": "EOF while scanning triple-quoted string literal (<ipython-input-3-377b842804df>, line 1)", |
| 11 | + "output_type": "error", |
| 12 | + "traceback": [ |
| 13 | + "\u001b[1;36m File \u001b[1;32m\"<ipython-input-3-377b842804df>\"\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" |
| 14 | + ] |
17 | 15 | } |
18 | 16 | ], |
19 | 17 | "source": [ |
|
22 | 20 | }, |
23 | 21 | { |
24 | 22 | "cell_type": "code", |
25 | | - "execution_count": 5, |
26 | | - "metadata": {}, |
| 23 | + "execution_count": 4, |
| 24 | + "metadata": { |
| 25 | + "collapsed": true, |
| 26 | + "jupyter": { |
| 27 | + "outputs_hidden": true |
| 28 | + } |
| 29 | + }, |
27 | 30 | "outputs": [ |
28 | 31 | { |
29 | 32 | "data": { |
30 | 33 | "text/plain": [ |
31 | | - "\"doubl'''''''''''''''''''''''''''''e quotes\"" |
| 34 | + "\"double quo''''''''tes\"" |
32 | 35 | ] |
33 | 36 | }, |
34 | | - "execution_count": 5, |
| 37 | + "execution_count": 4, |
35 | 38 | "metadata": {}, |
36 | 39 | "output_type": "execute_result" |
37 | 40 | } |
38 | 41 | ], |
39 | 42 | "source": [ |
40 | | - "\"doubl'''''''''''''''''''''''''''''e quotes\"" |
| 43 | + "\"double quo''''''''tes\"" |
41 | 44 | ] |
42 | 45 | }, |
43 | 46 | { |
44 | 47 | "cell_type": "code", |
45 | | - "execution_count": 4, |
| 48 | + "execution_count": 5, |
46 | 49 | "metadata": {}, |
47 | 50 | "outputs": [ |
48 | 51 | { |
|
51 | 54 | "\" wrap lot's of other quotes\"" |
52 | 55 | ] |
53 | 56 | }, |
54 | | - "execution_count": 4, |
| 57 | + "execution_count": 5, |
55 | 58 | "metadata": {}, |
56 | 59 | "output_type": "execute_result" |
57 | 60 | } |
|
62 | 65 | }, |
63 | 66 | { |
64 | 67 | "cell_type": "code", |
65 | | - "execution_count": 12, |
| 68 | + "execution_count": 14, |
66 | 69 | "metadata": {}, |
67 | 70 | "outputs": [ |
68 | 71 | { |
69 | | - "ename": "IndexError", |
70 | | - "evalue": "string index out of range", |
71 | | - "output_type": "error", |
72 | | - "traceback": [ |
73 | | - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", |
74 | | - "\u001b[1;31mIndexError\u001b[0m Traceback (most recent call last)", |
75 | | - "\u001b[1;32m<ipython-input-12-4eac88f5cf17>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[0ma\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;34m\"Hello, World!\"\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 2\u001b[1;33m \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0ma\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m13\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", |
76 | | - "\u001b[1;31mIndexError\u001b[0m: string index out of range" |
| 72 | + "name": "stdout", |
| 73 | + "output_type": "stream", |
| 74 | + "text": [ |
| 75 | + "!dlroW ,olleH\n" |
77 | 76 | ] |
78 | 77 | } |
79 | 78 | ], |
80 | 79 | "source": [ |
81 | 80 | "a = \"Hello, World!\"\n", |
82 | | - "print(a[13])" |
| 81 | + "print(a[::-1])" |
83 | 82 | ] |
84 | 83 | }, |
85 | 84 | { |
|
88 | 87 | "metadata": {}, |
89 | 88 | "outputs": [ |
90 | 89 | { |
91 | | - "name": "stdout", |
92 | | - "output_type": "stream", |
93 | | - "text": [ |
94 | | - "Soumya\n" |
| 90 | + "ename": "SyntaxError", |
| 91 | + "evalue": "invalid syntax (<ipython-input-15-b4dcd503e6f6>, line 2)", |
| 92 | + "output_type": "error", |
| 93 | + "traceback": [ |
| 94 | + "\u001b[1;36m File \u001b[1;32m\"<ipython-input-15-b4dcd503e6f6>\"\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" |
95 | 95 | ] |
96 | 96 | } |
97 | 97 | ], |
98 | 98 | "source": [ |
99 | | - "b =\"Soumyadip\"\n", |
100 | | - "print(b[0:6])" |
| 99 | + "str =\"P y t h o n J A V A C++\"\n", |
| 100 | + "l=\n" |
101 | 101 | ] |
102 | 102 | }, |
103 | 103 | { |
104 | 104 | "cell_type": "code", |
105 | | - "execution_count": 23, |
| 105 | + "execution_count": 11, |
106 | 106 | "metadata": {}, |
107 | 107 | "outputs": [ |
108 | 108 | { |
109 | | - "name": "stdout", |
110 | | - "output_type": "stream", |
111 | | - "text": [ |
112 | | - "654\n" |
113 | | - ] |
| 109 | + "data": { |
| 110 | + "text/plain": [ |
| 111 | + "'uDivyanshu'" |
| 112 | + ] |
| 113 | + }, |
| 114 | + "execution_count": 11, |
| 115 | + "metadata": {}, |
| 116 | + "output_type": "execute_result" |
114 | 117 | } |
115 | 118 | ], |
116 | 119 | "source": [ |
117 | | - "b = \"654321\"\n", |
118 | | - "print(b[-6:3])" |
| 120 | + "a=\"Divyanshu\"\n", |
| 121 | + "a=a[8]+a[0:]\n", |
| 122 | + "a" |
119 | 123 | ] |
120 | 124 | }, |
121 | 125 | { |
122 | 126 | "cell_type": "code", |
123 | | - "execution_count": 36, |
| 127 | + "execution_count": 25, |
124 | 128 | "metadata": {}, |
125 | 129 | "outputs": [ |
126 | 130 | { |
127 | | - "name": "stdout", |
128 | | - "output_type": "stream", |
129 | | - "text": [ |
130 | | - "9\n" |
131 | | - ] |
| 131 | + "data": { |
| 132 | + "text/plain": [ |
| 133 | + "6" |
| 134 | + ] |
| 135 | + }, |
| 136 | + "execution_count": 25, |
| 137 | + "metadata": {}, |
| 138 | + "output_type": "execute_result" |
132 | 139 | } |
133 | 140 | ], |
134 | 141 | "source": [ |
135 | | - "a = \"Dutipriya\"\n", |
136 | | - "print(len(a))" |
| 142 | + "a = \"Dutipr\"\n", |
| 143 | + "len(a)" |
137 | 144 | ] |
138 | 145 | }, |
139 | 146 | { |
140 | 147 | "cell_type": "code", |
141 | | - "execution_count": 32, |
| 148 | + "execution_count": 28, |
142 | 149 | "metadata": {}, |
143 | 150 | "outputs": [ |
144 | 151 | { |
145 | 152 | "name": "stdout", |
146 | 153 | "output_type": "stream", |
147 | 154 | "text": [ |
148 | | - "Atreyee\n" |
| 155 | + "Krishna\n" |
149 | 156 | ] |
150 | 157 | } |
151 | 158 | ], |
152 | 159 | "source": [ |
153 | | - "b = \"Atreyee\"\n", |
154 | | - "print(b[-7:7])" |
| 160 | + "b = \"Krishna\"\n", |
| 161 | + "print(b[-7:100])" |
155 | 162 | ] |
156 | 163 | }, |
157 | 164 | { |
158 | 165 | "cell_type": "code", |
159 | | - "execution_count": 38, |
| 166 | + "execution_count": 32, |
160 | 167 | "metadata": {}, |
161 | 168 | "outputs": [ |
162 | 169 | { |
163 | 170 | "name": "stdout", |
164 | 171 | "output_type": "stream", |
165 | 172 | "text": [ |
166 | | - "Hello, World!\n" |
| 173 | + "Hello, World!\n" |
167 | 174 | ] |
168 | 175 | } |
169 | 176 | ], |
170 | 177 | "source": [ |
171 | | - "a = \" Hello, World! \"\n", |
| 178 | + "a = \" Hello, World! \"\n", |
172 | 179 | "print(a.strip()) #Remove Space" |
173 | 180 | ] |
174 | 181 | }, |
175 | 182 | { |
176 | 183 | "cell_type": "code", |
177 | | - "execution_count": 45, |
| 184 | + "execution_count": 37, |
178 | 185 | "metadata": {}, |
179 | 186 | "outputs": [ |
180 | 187 | { |
181 | 188 | "name": "stdout", |
182 | 189 | "output_type": "stream", |
183 | 190 | "text": [ |
184 | | - "hello, world!\n", |
185 | | - "HelLo, World!\n", |
186 | | - "HelLo, World!\n" |
| 191 | + "HELLO, World!\n", |
| 192 | + "HELLO, WORLD!\n", |
| 193 | + "HELLO, World!\n", |
| 194 | + "hello, world!\n" |
187 | 195 | ] |
188 | 196 | } |
189 | 197 | ], |
190 | 198 | "source": [ |
191 | | - "a = \"HelLo, World!\"\n", |
192 | | - "print(a.lower())\n", |
| 199 | + "a = \"HELLO, World!\"\n", |
| 200 | + "print(a)\n", |
| 201 | + "print(a.upper())\n", |
193 | 202 | "print(a)\n", |
194 | 203 | "a=a.lower()\n", |
195 | | - "print(a)" |
| 204 | + "print(a)\n" |
196 | 205 | ] |
197 | 206 | }, |
198 | 207 | { |
199 | 208 | "cell_type": "code", |
200 | | - "execution_count": 44, |
| 209 | + "execution_count": 2, |
201 | 210 | "metadata": {}, |
202 | 211 | "outputs": [ |
203 | 212 | { |
204 | 213 | "name": "stdout", |
205 | 214 | "output_type": "stream", |
206 | 215 | "text": [ |
207 | | - "Jello, World!\n", |
| 216 | + "HeDhritimano, World!\n", |
208 | 217 | "Hello, World!\n", |
209 | 218 | "Jello, World!\n" |
210 | 219 | ] |
211 | 220 | } |
212 | 221 | ], |
213 | 222 | "source": [ |
214 | 223 | "a = \"Hello, World!\"\n", |
215 | | - "print(a.replace(\"H\", \"J\"))\n", |
| 224 | + "print(a.replace(\"ll\", \"Dhritiman\"))\n", |
216 | 225 | "print(a)\n", |
217 | 226 | "a=a.replace(\"H\", \"J\")\n", |
218 | 227 | "print(a)" |
219 | 228 | ] |
220 | 229 | }, |
221 | 230 | { |
222 | 231 | "cell_type": "code", |
223 | | - "execution_count": 53, |
| 232 | + "execution_count": 59, |
224 | 233 | "metadata": {}, |
225 | 234 | "outputs": [ |
226 | 235 | { |
227 | 236 | "name": "stdout", |
228 | 237 | "output_type": "stream", |
229 | 238 | "text": [ |
230 | | - "['He', '', 'do, Wor', 'd!']\n" |
| 239 | + "['', 'C']\n" |
231 | 240 | ] |
232 | 241 | } |
233 | 242 | ], |
234 | 243 | "source": [ |
235 | | - "a = \"Helldo, World!\"\n", |
236 | | - "print(a.split(\"l\"))" |
| 244 | + "a = \"ABC\"\n", |
| 245 | + "print(a.split(\"AB\"))" |
237 | 246 | ] |
238 | 247 | }, |
239 | 248 | { |
240 | 249 | "cell_type": "code", |
241 | | - "execution_count": 54, |
| 250 | + "execution_count": 61, |
242 | 251 | "metadata": {}, |
243 | 252 | "outputs": [ |
244 | 253 | { |
|
251 | 260 | ], |
252 | 261 | "source": [ |
253 | 262 | "txt = \"The rain in Spain stays mainly in the plain\"\n", |
254 | | - "x = \"aidegfdhfdgdhdn\" in txt\n", |
| 263 | + "x = \"Speutrwyhejwjq3w4jhjain\" in txt\n", |
255 | 264 | "print(x)" |
256 | 265 | ] |
257 | 266 | }, |
258 | 267 | { |
259 | 268 | "cell_type": "code", |
260 | | - "execution_count": 112, |
| 269 | + "execution_count": 71, |
261 | 270 | "metadata": {}, |
262 | 271 | "outputs": [ |
263 | 272 | { |
264 | 273 | "name": "stdout", |
265 | 274 | "output_type": "stream", |
266 | 275 | "text": [ |
267 | | - "10gfchbfdgnhdfghndfgnfdgndfgn 10 \n" |
| 276 | + "Python 10\n" |
268 | 277 | ] |
269 | 278 | } |
270 | 279 | ], |
271 | 280 | "source": [ |
272 | 281 | "a=10\n", |
273 | 282 | "b=\"Python\"\n", |
274 | | - "c=\"{}gfchbfdgnhdfghndfgnfdgndfgn {} \"\n", |
275 | | - "print(c.format(a,a))\n" |
| 283 | + "c=\"{} {}\"\n", |
| 284 | + "print(c.format(b,a,a,a,a,a,a,a))\n" |
276 | 285 | ] |
277 | 286 | }, |
278 | 287 | { |
279 | 288 | "cell_type": "code", |
280 | | - "execution_count": 113, |
| 289 | + "execution_count": 96, |
281 | 290 | "metadata": {}, |
282 | 291 | "outputs": [ |
283 | 292 | { |
284 | 293 | "name": "stdout", |
285 | 294 | "output_type": "stream", |
286 | 295 | "text": [ |
287 | | - "10 JAVA 10 JAVA\n" |
| 296 | + " 333 443 233 133 \n" |
288 | 297 | ] |
289 | 298 | } |
290 | 299 | ], |
291 | 300 | "source": [ |
292 | | - "a=10\n", |
293 | | - "b=\"Python\"\n", |
294 | | - "d=\"JAVA\"\n", |
295 | | - "e=\"C++\"\n", |
296 | | - "c=\"{} {} {} {}\"\n", |
297 | | - "print(c.format(a,d,a,d))\n" |
| 301 | + "a=133\n", |
| 302 | + "b=\"233\"\n", |
| 303 | + "d=\"333\"\n", |
| 304 | + "e=\"443\"\n", |
| 305 | + "c=\" {1} {0} {3} {2} \"\n", |
| 306 | + "print(c.format(a,b,e,d))\n" |
298 | 307 | ] |
299 | 308 | }, |
300 | 309 | { |
|
0 commit comments