Skip to content

Commit 1ca6f7e

Browse files
author
Rise Riyo
committed
reverted change in translate function example due to extra credit
1 parent c7bdc90 commit 1ca6f7e

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

part-4.ipynb

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"metadata": {
33
"name": "",
4-
"signature": "sha256:1ea7dc49f946546b6ab2dc4d73a06849f0f6994a0ee6912c4368f0caf20e1f3f"
4+
"signature": "sha256:2e85a1190fdc5f2a5f5567835384cdf4dc4a717102ea921578a4ee8c4d69eccc"
55
},
66
"nbformat": 3,
77
"nbformat_minor": 0,
@@ -353,13 +353,15 @@
353353
"\n",
354354
"def translate(sentence):\n",
355355
" spanish_words = sentence.split()\n",
356-
" english_words = [words[w] for w in spanish_words]\n",
356+
" english_words = []\n",
357+
" for w in spanish_words:\n",
358+
" english_words.append(words[w])\n",
357359
" return \" \".join(english_words)"
358360
],
359361
"language": "python",
360362
"metadata": {},
361363
"outputs": [],
362-
"prompt_number": 35
364+
"prompt_number": 39
363365
},
364366
{
365367
"cell_type": "code",
@@ -373,13 +375,13 @@
373375
{
374376
"metadata": {},
375377
"output_type": "pyout",
376-
"prompt_number": 36,
378+
"prompt_number": 40,
377379
"text": [
378380
"'the dog ate the burrito green'"
379381
]
380382
}
381383
],
382-
"prompt_number": 36
384+
"prompt_number": 40
383385
},
384386
{
385387
"cell_type": "code",
@@ -405,7 +407,7 @@
405407
"cell_type": "markdown",
406408
"metadata": {},
407409
"source": [
408-
"**Extra Credit:** turn the translate function into a single list comprehension."
410+
"**Extra Credit:** Try using a list comprehension in the translate function."
409411
]
410412
},
411413
{

0 commit comments

Comments
 (0)