From 59f14310198011135431429c00c611229f0232af Mon Sep 17 00:00:00 2001 From: Aliaksandr Yakutovich Date: Wed, 26 Apr 2023 20:50:02 +0200 Subject: [PATCH 1/2] Fix exercise 3 on strings. --- basic_datatypes.ipynb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/basic_datatypes.ipynb b/basic_datatypes.ipynb index e46959f7..2f605817 100644 --- a/basic_datatypes.ipynb +++ b/basic_datatypes.ipynb @@ -2214,7 +2214,7 @@ "* `string.endswith(suffix, start, end)` - returns `True` if the string ends with the suffix, `False` otherwise\n", "* `string.find(substring, start, end)` - returns the lowest index in the string where substring is found, or `-1` if not found\n", "* `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", - "* `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", + "* `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 function will split on any whitespace character.\n", "* `string.join(iterable)` - returns a string consisting of the strings in the iterable joined by the string on which the method is called\n", "* `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", "* `string.isalnum()` - returns `True` if the string consists of alphanumeric characters, `False` otherwise\n", @@ -2234,11 +2234,11 @@ "source": [ "## Exercises on strings\n", "\n", - "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", - "2. Write a program that recieves a string as input and returns a copy of the string with all the characters lowercased.\n", - "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", - "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", - "5. Write a program that recieves a string as input and returns a list of the lines in the string, breaking at line boundaries." + "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", + "2. Write a program that receives a string as input and returns a copy of the string with all the characters lowercased.\n", + "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", + "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", + "5. Write a program that receives a string as input and returns a list of the lines in the string, breaking at line boundaries." ] }, { From a0ab68dc3feec926718386858279c19bb208b925 Mon Sep 17 00:00:00 2001 From: Aliaksandr Yakutovich Date: Wed, 26 Apr 2023 20:53:00 +0200 Subject: [PATCH 2/2] Small rephrasing. --- basic_datatypes.ipynb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/basic_datatypes.ipynb b/basic_datatypes.ipynb index 2f605817..0cab454f 100644 --- a/basic_datatypes.ipynb +++ b/basic_datatypes.ipynb @@ -2201,6 +2201,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -2214,7 +2215,7 @@ "* `string.endswith(suffix, start, end)` - returns `True` if the string ends with the suffix, `False` otherwise\n", "* `string.find(substring, start, end)` - returns the lowest index in the string where substring is found, or `-1` if not found\n", "* `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", - "* `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 function will split on any whitespace character.\n", + "* `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", "* `string.join(iterable)` - returns a string consisting of the strings in the iterable joined by the string on which the method is called\n", "* `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", "* `string.isalnum()` - returns `True` if the string consists of alphanumeric characters, `False` otherwise\n", @@ -2736,7 +2737,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.1" + "version": "3.9.6" }, "vscode": { "interpreter": {