|
2201 | 2201 | ]
|
2202 | 2202 | },
|
2203 | 2203 | {
|
| 2204 | + "attachments": {}, |
2204 | 2205 | "cell_type": "markdown",
|
2205 | 2206 | "metadata": {},
|
2206 | 2207 | "source": [
|
|
2214 | 2215 | "* `string.endswith(suffix, start, end)` - returns `True` if the string ends with the suffix, `False` otherwise\n",
|
2215 | 2216 | "* `string.find(substring, start, end)` - returns the lowest index in the string where substring is found, or `-1` if not found\n",
|
2216 | 2217 | "* `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", |
2218 | 2219 | "* `string.join(iterable)` - returns a string consisting of the strings in the iterable joined by the string on which the method is called\n",
|
2219 | 2220 | "* `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",
|
2220 | 2221 | "* `string.isalnum()` - returns `True` if the string consists of alphanumeric characters, `False` otherwise\n",
|
|
2234 | 2235 | "source": [
|
2235 | 2236 | "## Exercises on strings\n",
|
2236 | 2237 | "\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." |
2242 | 2243 | ]
|
2243 | 2244 | },
|
2244 | 2245 | {
|
|
2736 | 2737 | "name": "python",
|
2737 | 2738 | "nbconvert_exporter": "python",
|
2738 | 2739 | "pygments_lexer": "ipython3",
|
2739 |
| - "version": "3.11.1" |
| 2740 | + "version": "3.9.6" |
2740 | 2741 | },
|
2741 | 2742 | "vscode": {
|
2742 | 2743 | "interpreter": {
|
|
0 commit comments