Skip to content

Commit ffcbd82

Browse files
author
Rise Riyo
committed
demo result of joining the translated words from the list comprehension
1 parent 951fba9 commit ffcbd82

File tree

1 file changed

+25
-82
lines changed

1 file changed

+25
-82
lines changed

part-4.ipynb

Lines changed: 25 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"metadata": {
33
"name": "",
4-
"signature": "sha256:438a503ded59b13e7295fbf00a26fef4b584f4309f97d9e2a2ab45c4b291eabf"
4+
"signature": "sha256:6d49e8f391efd616a50a4c712a7081065abec4b33a013ba183f59e755696f1f5"
55
},
66
"nbformat": 3,
77
"nbformat_minor": 0,
@@ -217,8 +217,7 @@
217217
],
218218
"language": "python",
219219
"metadata": {},
220-
"outputs": [],
221-
"prompt_number": 20
220+
"outputs": []
222221
},
223222
{
224223
"cell_type": "code",
@@ -228,17 +227,7 @@
228227
],
229228
"language": "python",
230229
"metadata": {},
231-
"outputs": [
232-
{
233-
"metadata": {},
234-
"output_type": "pyout",
235-
"prompt_number": 21,
236-
"text": [
237-
"'cat'"
238-
]
239-
}
240-
],
241-
"prompt_number": 21
230+
"outputs": []
242231
},
243232
{
244233
"cell_type": "markdown",
@@ -255,17 +244,7 @@
255244
],
256245
"language": "python",
257246
"metadata": {},
258-
"outputs": [
259-
{
260-
"metadata": {},
261-
"output_type": "pyout",
262-
"prompt_number": 22,
263-
"text": [
264-
"True"
265-
]
266-
}
267-
],
268-
"prompt_number": 22
247+
"outputs": []
269248
},
270249
{
271250
"cell_type": "markdown",
@@ -282,17 +261,7 @@
282261
],
283262
"language": "python",
284263
"metadata": {},
285-
"outputs": [
286-
{
287-
"metadata": {},
288-
"output_type": "pyout",
289-
"prompt_number": 23,
290-
"text": [
291-
"6"
292-
]
293-
}
294-
],
295-
"prompt_number": 23
264+
"outputs": []
296265
},
297266
{
298267
"cell_type": "markdown",
@@ -311,23 +280,13 @@
311280
],
312281
"language": "python",
313282
"metadata": {},
314-
"outputs": [
315-
{
316-
"metadata": {},
317-
"output_type": "pyout",
318-
"prompt_number": 24,
319-
"text": [
320-
"['el', 'gato', 'esta', 'en', 'la', 'casa']"
321-
]
322-
}
323-
],
324-
"prompt_number": 24
283+
"outputs": []
325284
},
326285
{
327286
"cell_type": "markdown",
328287
"metadata": {},
329288
"source": [
330-
"Let's loop over each word in the list and translate each one by using a list comprehension."
289+
"Let's translate each word and save them in the list called translated_words. We'll generate this list by using a list comprehension."
331290
]
332291
},
333292
{
@@ -352,53 +311,27 @@
352311
]
353312
}
354313
],
355-
"prompt_number": 28
314+
"prompt_number": 29
356315
},
357316
{
358317
"cell_type": "code",
359318
"collapsed": false,
360319
"input": [
361-
"for spanish_word in sentence_words:\n",
362-
" print(words[spanish_word])"
320+
"translated_words"
363321
],
364322
"language": "python",
365323
"metadata": {},
366324
"outputs": [
367325
{
368-
"output_type": "stream",
369-
"stream": "stdout",
326+
"metadata": {},
327+
"output_type": "pyout",
328+
"prompt_number": 31,
370329
"text": [
371-
"the\n",
372-
"cat\n",
373-
"is\n",
374-
"in\n",
375-
"the\n",
376-
"house\n"
330+
"['the', 'cat', 'is', 'in', 'the', 'house']"
377331
]
378332
}
379333
],
380-
"prompt_number": 25
381-
},
382-
{
383-
"cell_type": "markdown",
384-
"metadata": {},
385-
"source": [
386-
"Now let's make a list from the translated words."
387-
]
388-
},
389-
{
390-
"cell_type": "code",
391-
"collapsed": false,
392-
"input": [
393-
"translated_words = []\n",
394-
"for spanish_word in sentence_words:\n",
395-
" translated_words.append(words[spanish_word])\n",
396-
"\n",
397-
"translated_words"
398-
],
399-
"language": "python",
400-
"metadata": {},
401-
"outputs": []
334+
"prompt_number": 31
402335
},
403336
{
404337
"cell_type": "markdown",
@@ -416,7 +349,17 @@
416349
],
417350
"language": "python",
418351
"metadata": {},
419-
"outputs": []
352+
"outputs": [
353+
{
354+
"metadata": {},
355+
"output_type": "pyout",
356+
"prompt_number": 32,
357+
"text": [
358+
"'the cat is in the house'"
359+
]
360+
}
361+
],
362+
"prompt_number": 32
420363
},
421364
{
422365
"cell_type": "markdown",

0 commit comments

Comments
 (0)