8000 Fix exercise 3 on strings (#97) · gaehlerm/python-tutorial@ce9c992 · GitHub
[go: up one dir, main page]

Skip to content

Commit ce9c992

Browse files
authored
Fix exercise 3 on strings (empa-scientific-it#97)
1 parent fbe6c25 commit ce9c992

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

basic_datatypes.ipynb

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2201,6 +2201,7 @@
22012201
]
22022202
},
22032203
{
2204+
"attachments": {},
22042205
"cell_type": "markdown",
22052206
"metadata": {},
22062207
"source": [
@@ -2214,7 +2215,7 @@
22142215
"* `string.endswith(suffix, start, end)` - returns `True` if the string ends with the suffix, `False` otherwise\n",
22152216
"* `string.find(substring, start, end)` - returns the lowest index in the string where substring is found, or `-1` if not found\n",
22162217
"* `string.replace(old, new, number)` - returns a copy of the string with `number` occurrences of old replaced by new. If `number` is omitted, all occurrences are replaced\n",
2217-
"* `string.split(separator, maxsplit)` - returns a list of the words in the string, using separator as the delimiter string. If `maxsplit` is given, at most `maxsplit` splits are done\n",
2218+
"* `string.split(separator, maxsplit)` - returns a list of the words in the string, using a separator as the delimiter string. If `maxsplit` is given, at most `maxsplit` splits are done. If `separator` is not provided, the string will be split on any whitespace character.\n",
22182219
"* `string.join(iterable)` - returns a string consisting of the strings in the iterable joined by the string on which the method is called\n",
22192220
"* `string.splitlines(keepends)` - returns a list of the lines in the string, breaking at line boundaries. If `keepends` is `True`, the line breaks are included in the resulting list\n",
22202221
"* `string.isalnum()` - returns `True` if the string consists of alphanumeric characters, `False` otherwise\n",
@@ -2234,11 +2235,11 @@
22342235
"source": [
22352236
"## Exercises on strings\n",
22362237
"\n",
2237-
"1. Write a program that recieves a string as input and returns a copy of the string with the first character capitalized and the rest lowercased.\n",
2238-
"2. Write a program that recieves a string as input and returns a copy of the string with all the characters lowercased.\n",
2239-
"3. Write a program that recieves a string with several words separated by spaces as input and returns a list of the words in the string.\n",
2240-
"4. Write a program that recieves a list of words as input and returns a string consisting of the words in the list separated by commas.\n",
2241-
"5. Write a program that recieves a string as input and returns a list of the lines in the string, breaking at line boundaries."
2238+
"1. Write a program that receives a string as input and returns a copy of the string with the first character capitalized and the rest lowercased.\n",
2239+
"2. Write a program that receives a string as input and returns a copy of the string with all the characters lowercased.\n",
2240+
"3. Write a program that receives a string with several words separated by any whitespace character (space, new line, Tab, etc.) as input and returns a list of the words in the string.\n",
2241+
"4. Write a program that receives a list of words as input and returns a string consisting of the words in the list separated by commas.\n",
2242+
"5. Write a program that receives a string as input and returns a list of the lines in the string, breaking at line boundaries."
22422243
]
22432244
},
22442245
{
@@ -2736,7 +2737,7 @@
27362737
"name": "python",
27372738
"nbconvert_exporter": "python",
27382739
"pygments_lexer": "ipython3",
2739-
"version": "3.11.1"
2740+
"version": "3.9.6"
27402741
},
27412742
"vscode": {
27422743
"interpreter": {

0 commit comments

Comments
 (0)
0