Skip to content

Commit 1efa0fa

Browse files
committed
added notes on join
1 parent 37b9296 commit 1efa0fa

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

03-Methods and Functions/.ipynb_checkpoints/03-Function Practice Exercises-checkpoint.ipynb

+11-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,17 @@
206206
"#### MASTER YODA: Given a sentence, return a sentence with the words reversed\n",
207207
"\n",
208208
" master_yoda('I am home') --> 'home am I'\n",
209-
" master_yoda('We are ready') --> 'ready are We'"
209+
" master_yoda('We are ready') --> 'ready are We'\n",
210+
" \n",
211+
"Note: The .join() method may be useful here. The .join() method allows you to join together strings in a list with some connector string. For example, some uses of the .join() method:\n",
212+
"\n",
213+
" >>> \"--\".join(['a','b','c'])\n",
214+
" >>> 'a--b--c'\n",
215+
"\n",
216+
"This means if you had a list of words you wanted to turn back into a sentence, you could just join them with a single space string:\n",
217+
"\n",
218+
" >>> \" \".join(['Hello','world'])\n",
219+
" >>> \"Hello world\""
210220
]
211221
},
212222
{

03-Methods and Functions/03-Function Practice Exercises.ipynb

+11-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,17 @@
206206
"#### MASTER YODA: Given a sentence, return a sentence with the words reversed\n",
207207
"\n",
208208
" master_yoda('I am home') --> 'home am I'\n",
209-
" master_yoda('We are ready') --> 'ready are We'"
209+
" master_yoda('We are ready') --> 'ready are We'\n",
210+
" \n",
211+
"Note: The .join() method may be useful here. The .join() method allows you to join together strings in a list with some connector string. For example, some uses of the .join() method:\n",
212+
"\n",
213+
" >>> \"--\".join(['a','b','c'])\n",
214+
" >>> 'a--b--c'\n",
215+
"\n",
216+
"This means if you had a list of words you wanted to turn back into a sentence, you could just join them with a single space string:\n",
217+
"\n",
218+
" >>> \" \".join(['Hello','world'])\n",
219+
" >>> \"Hello world\""
210220
]
211221
},
212222
{

0 commit comments

Comments
 (0)