Skip to content

Commit 1548d94

Browse files
committed
Update String.ipynb
1 parent 1b2b64f commit 1548d94

File tree

1 file changed

+92
-83
lines changed

1 file changed

+92
-83
lines changed

String.ipynb

+92-83
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,16 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 4,
5+
"execution_count": 3,
66
"metadata": {},
77
"outputs": [
88
{
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+
]
1715
}
1816
],
1917
"source": [
@@ -22,27 +20,32 @@
2220
},
2321
{
2422
"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+
},
2730
"outputs": [
2831
{
2932
"data": {
3033
"text/plain": [
31-
"\"doubl'''''''''''''''''''''''''''''e quotes\""
34+
"\"double quo''''''''tes\""
3235
]
3336
},
34-
"execution_count": 5,
37+
"execution_count": 4,
3538
"metadata": {},
3639
"output_type": "execute_result"
3740
}
3841
],
3942
"source": [
40-
"\"doubl'''''''''''''''''''''''''''''e quotes\""
43+
"\"double quo''''''''tes\""
4144
]
4245
},
4346
{
4447
"cell_type": "code",
45-
"execution_count": 4,
48+
"execution_count": 5,
4649
"metadata": {},
4750
"outputs": [
4851
{
@@ -51,7 +54,7 @@
5154
"\" wrap lot's of other quotes\""
5255
]
5356
},
54-
"execution_count": 4,
57+
"execution_count": 5,
5558
"metadata": {},
5659
"output_type": "execute_result"
5760
}
@@ -62,24 +65,20 @@
6265
},
6366
{
6467
"cell_type": "code",
65-
"execution_count": 12,
68+
"execution_count": 14,
6669
"metadata": {},
6770
"outputs": [
6871
{
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"
7776
]
7877
}
7978
],
8079
"source": [
8180
"a = \"Hello, World!\"\n",
82-
"print(a[13])"
81+
"print(a[::-1])"
8382
]
8483
},
8584
{
@@ -88,157 +87,167 @@
8887
"metadata": {},
8988
"outputs": [
9089
{
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"
9595
]
9696
}
9797
],
9898
"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"
101101
]
102102
},
103103
{
104104
"cell_type": "code",
105-
"execution_count": 23,
105+
"execution_count": 11,
106106
"metadata": {},
107107
"outputs": [
108108
{
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"
114117
}
115118
],
116119
"source": [
117-
"b = \"654321\"\n",
118-
"print(b[-6:3])"
120+
"a=\"Divyanshu\"\n",
121+
"a=a[8]+a[0:]\n",
122+
"a"
119123
]
120124
},
121125
{
122126
"cell_type": "code",
123-
"execution_count": 36,
127+
"execution_count": 25,
124128
"metadata": {},
125129
"outputs": [
126130
{
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"
132139
}
133140
],
134141
"source": [
135-
"a = \"Dutipriya\"\n",
136-
"print(len(a))"
142+
"a = \"Dutipr\"\n",
143+
"len(a)"
137144
]
138145
},
139146
{
140147
"cell_type": "code",
141-
"execution_count": 32,
148+
"execution_count": 28,
142149
"metadata": {},
143150
"outputs": [
144151
{
145152
"name": "stdout",
146153
"output_type": "stream",
147154
"text": [
148-
"Atreyee\n"
155+
"Krishna\n"
149156
]
150157
}
151158
],
152159
"source": [
153-
"b = \"Atreyee\"\n",
154-
"print(b[-7:7])"
160+
"b = \"Krishna\"\n",
161+
"print(b[-7:100])"
155162
]
156163
},
157164
{
158165
"cell_type": "code",
159-
"execution_count": 38,
166+
"execution_count": 32,
160167
"metadata": {},
161168
"outputs": [
162169
{
163170
"name": "stdout",
164171
"output_type": "stream",
165172
"text": [
166-
"Hello, World!\n"
173+
"Hello, World!\n"
167174
]
168175
}
169176
],
170177
"source": [
171-
"a = \" Hello, World! \"\n",
178+
"a = \" Hello, World! \"\n",
172179
"print(a.strip()) #Remove Space"
173180
]
174181
},
175182
{
176183
"cell_type": "code",
177-
"execution_count": 45,
184+
"execution_count": 37,
178185
"metadata": {},
179186
"outputs": [
180187
{
181188
"name": "stdout",
182189
"output_type": "stream",
183190
"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"
187195
]
188196
}
189197
],
190198
"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",
193202
"print(a)\n",
194203
"a=a.lower()\n",
195-
"print(a)"
204+
"print(a)\n"
196205
]
197206
},
198207
{
199208
"cell_type": "code",
200-
"execution_count": 44,
209+
"execution_count": 2,
201210
"metadata": {},
202211
"outputs": [
203212
{
204213
"name": "stdout",
205214
"output_type": "stream",
206215
"text": [
207-
"Jello, World!\n",
216+
"HeDhritimano, World!\n",
208217
"Hello, World!\n",
209218
"Jello, World!\n"
210219
]
211220
}
212221
],
213222
"source": [
214223
"a = \"Hello, World!\"\n",
215-
"print(a.replace(\"H\", \"J\"))\n",
224+
"print(a.replace(\"ll\", \"Dhritiman\"))\n",
216225
"print(a)\n",
217226
"a=a.replace(\"H\", \"J\")\n",
218227
"print(a)"
219228
]
220229
},
221230
{
222231
"cell_type": "code",
223-
"execution_count": 53,
232+
"execution_count": 59,
224233
"metadata": {},
225234
"outputs": [
226235
{
227236
"name": "stdout",
228237
"output_type": "stream",
229238
"text": [
230-
"['He', '', 'do, Wor', 'd!']\n"
239+
"['', 'C']\n"
231240
]
232241
}
233242
],
234243
"source": [
235-
"a = \"Helldo, World!\"\n",
236-
"print(a.split(\"l\"))"
244+
"a = \"ABC\"\n",
245+
"print(a.split(\"AB\"))"
237246
]
238247
},
239248
{
240249
"cell_type": "code",
241-
"execution_count": 54,
250+
"execution_count": 61,
242251
"metadata": {},
243252
"outputs": [
244253
{
@@ -251,50 +260,50 @@
251260
],
252261
"source": [
253262
"txt = \"The rain in Spain stays mainly in the plain\"\n",
254-
"x = \"aidegfdhfdgdhdn\" in txt\n",
263+
"x = \"Speutrwyhejwjq3w4jhjain\" in txt\n",
255264
"print(x)"
256265
]
257266
},
258267
{
259268
"cell_type": "code",
260-
"execution_count": 112,
269+
"execution_count": 71,
261270
"metadata": {},
262271
"outputs": [
263272
{
264273
"name": "stdout",
265274
"output_type": "stream",
266275
"text": [
267-
"10gfchbfdgnhdfghndfgnfdgndfgn 10 \n"
276+
"Python 10\n"
268277
]
269278
}
270279
],
271280
"source": [
272281
"a=10\n",
273282
"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"
276285
]
277286
},
278287
{
279288
"cell_type": "code",
280-
"execution_count": 113,
289+
"execution_count": 96,
281290
"metadata": {},
282291
"outputs": [
283292
{
284293
"name": "stdout",
285294
"output_type": "stream",
286295
"text": [
287-
"10 JAVA 10 JAVA\n"
296+
" 333 443 233 133 \n"
288297
]
289298
}
290299
],
291300
"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"
298307
]
299308
},
300309
{

0 commit comments

Comments
 (0)