You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Little Sisters Vocab and Essay]: Typo & Formatting Fixes for String Related Concept Exercises. (exercism#4172)
* Typo and formatting fixes for string related concept exercises.
* Rewording formatting sentence for clarity and grammar.
* Removed errant comma from introduction.
Copy file name to clipboardExpand all lines: concepts/string-methods/about.md
+6-5Lines changed: 6 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,13 +6,14 @@ This may include letters, diacritical marks, positioning characters, numbers, cu
6
6
Strings implement all [common sequence operations][common sequence operations] and can be iterated through using `for item in <str>` or `for index, item in enumerate(<str>)` syntax.
7
7
Individual code points (_strings of length 1_) can be referenced by `0-based index` number from the left, or `-1-based index` number from the right.
8
8
9
-
Strings can be concatenated using `<str> + <other str>` or `<str>.join(<iterable>)`, split via `<str>.split(<separator>)`, and offer multiple formatting and assembly options.
9
+
Strings can be concatenated using `<str> + <other str>` or `<str>.join(<iterable>)` and split via `<str>.split(<separator>)`.
10
+
They also offer multiple other formatting and assembly options.
10
11
11
12
To further work with strings, Python provides a rich set of [string methods][str-methods] for searching, cleaning, transforming, translating, and many other operations.
12
13
13
14
Some of the more commonly used `str` methods include:
14
15
15
-
- Checking for prefixes/suffixes with `startswith(<substr>)` and `endswith(<substr>)`
16
+
- Checking for prefixes/suffixes with `<str>.startswith(<substr>)` and `<str>.endswith(<substr>)`
16
17
- Altering string casing with methods like `<str>.title()`, `<str>.upper()`/`<str>.lower()`, and `<str>.swapcase()`
17
18
- Removing leading or trailing characters from a string using `<str>.strip(<chars>)`, `<str>.lstrip(<chars>)`, or `<str>.rstrip(<chars>)`
18
19
- Replacing substrings with the `<str>.replace(<old>, <new>)` method
@@ -33,7 +34,7 @@ True
33
34
>>>'Do you want to 💃?'.endswith('💃')
34
35
False
35
36
36
-
>>'The quick brown fox jumped over the lazy dog.'.endswith('dog')
37
+
>>>'The quick brown fox jumped over the lazy dog.'.endswith('dog')
37
38
False
38
39
```
39
40
@@ -117,7 +118,7 @@ Just the place for a Snark! I have said it thrice:
117
118
'book keeper'
118
119
```
119
120
120
-
:star:**Newly added in Python `3.9`**
121
+
🌟**Newly added in Python `3.9`**
121
122
122
123
Python `3.9` introduces two new string methods that make removing prefixes and suffixes much easier.
123
124
@@ -144,7 +145,7 @@ Python `3.9` introduces two new string methods that make removing prefixes and s
144
145
For more examples and methods the [informal tutorial][informal tutorial] is a nice jumping-off point.
145
146
[How to Unicode][howto unicode] in the Python docs offers great detail on Unicode, encoding, bytes, and other technical considerations for working with strings in Python.
146
147
147
-
Python also supports regular expressions via the `re` module, which will be covered in a future exercise.
148
+
Python also supports regular expressions via the `re` module, which will be covered in a future concept.
Copy file name to clipboardExpand all lines: concepts/strings/about.md
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,12 +4,13 @@ A `str` in Python is an [immutable sequence][text sequence] of [Unicode code poi
4
4
These may include letters, diacritical marks, positioning characters, numbers, currency symbols, emoji, punctuation, space and line break characters, and more.
5
5
6
6
For a deep dive on what information a string encodes (or, _"how does a computer know how to translate zeroes and ones into letters?"_), [this blog post is enduringly helpful][joel-on-text].
7
-
The Python docs also provide a very detailed [unicode HOWTO][unicode how-to] that discusses Pythons support for the Unicode specification in the `str`, `bytes` and `re` modules, considerations for locales, and some common issues with encoding and translation.
7
+
The Python docs also provide a very detailed [unicode HOWTO][unicode how-to] that discusses Python's support for the Unicode specification in the `str`, `bytes` and `re` modules, considerations for locales, and some common issues with encoding and translation.
8
8
9
9
Strings implement all [common sequence operations][common sequence operations] and can be iterated through using `for item in <str>` or `for index, item in enumerate(<str>)` syntax.
10
10
Individual code points (_strings of length 1_) can be referenced by `0-based index` number from the left, or `-1-based index` number from the right.
11
11
12
-
Strings can be concatenated with `<str> + <other str>`, or `<str>.join(<iterable>)`, split via `<str>.split(<separator>)`, and offer multiple formatting, assembly, and templating options.
12
+
Strings can be concatenated with `<str> + <other str>` or `<str>.join(<iterable>)` and split via `<str>.split(<separator>)`.
13
+
They also offer multiple additional formatting, assembly, and templating options.
13
14
14
15
15
16
A `str` literal can be declared using single `'` or double `"` quotes. The escape `\` character is available as needed.
@@ -101,7 +102,7 @@ There is no separate “character” or "rune" type in Python, so indexing a str
101
102
True
102
103
```
103
104
104
-
Substrings can be selected via _slice notation_, using [`<str>[<start>:stop:<step>]`][common sequence operations] to produce a new string.
105
+
Substrings can be selected via _slice notation_, using [`<str>[<start>:<stop>:<step>]`][common sequence operations] to produce a new string.
105
106
Results exclude the `stop` index.
106
107
If no `start` is given, the starting index will be 0.
107
108
If no `stop` is given, the `stop` index will be the end of the string.
Copy file name to clipboardExpand all lines: concepts/strings/introduction.md
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,12 +5,13 @@ These could include letters, diacritical marks, positioning characters, numbers,
5
5
6
6
Strings implement all [common sequence operations][common sequence operations], and can be iterated through using `for item in <string>` or `for index, item in enumerate(<string>)` syntax.
7
7
8
-
Strings can be concatenated with `<str> + <other str>`, or `<str>.join(<iterable>)`, split via `<str>.split(<separator>)`, and offer multiple types of formatting, interpolation, and templating.
8
+
Strings can be concatenated with `<str> + <other str>` or `<str>.join(<iterable>)` and split via `<str>.split(<separator>)`.
9
+
They also offer multiple additional formatting, assembly, and templating options.
9
10
10
11
Being immutable, a `str` object's value in memory doesn't change; methods that appear to modify a string return a new copy or instance of `str`.
11
12
12
13
For a deep dive on what information a string encodes (or, _"how does a computer know how to translate zeroes and ones into letters?"_), [this blog post is enduringly helpful][joel-on-text].
13
-
The Python docs also provide a very detailed [unicode HOWTO][unicode how-to] that discusses Pythons support for the Unicode specification in the `str`, `bytes` and `re` modules, considerations for locales, and some common issues with encoding and translation.
14
+
The Python docs also provide a very detailed [unicode HOWTO][unicode how-to] that discusses Python's support for the Unicode specification in the `str`, `bytes` and `re` modules, considerations for locales, and some common issues with encoding and translation.
Copy file name to clipboardExpand all lines: exercises/concept/little-sisters-vocab/.docs/hints.md
+2-3Lines changed: 2 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,12 +19,11 @@ There's four activities in the assignment, each with a set of text or words to w
19
19
- Remember that delimiter strings go between elements and "glue" them together into a single string. Delimiters are inserted _without_ space, although you can include space characters within them.
20
20
- Like [`str.split()`][str-split], `str.join()` can process an arbitrary-length string, made up of any unicode code points. _Unlike_`str.split()`, it can also process arbitrary-length iterables like `list`, `tuple`, and `set`.
21
21
22
-
23
22
## 3. Remove a suffix from a word
24
23
25
24
- Strings can be indexed or sliced from either the left (starting at 0) or the right (starting at -1).
26
-
- If you want the last code point of an arbitrary-length string, you can use [-1].
27
-
- The last three letters in a string can be "sliced off" using a negative index. e.g. 'beautiful'[:-3] == 'beauti'
25
+
- If you want the last code point of an arbitrary-length string, you can use `[-1]`.
26
+
- The last three letters in a string can be "sliced off" using a negative index. e.g. `beautiful'[:-3] == 'beauti`
0 commit comments