Skip to content

Commit 977c3de

Browse files
authored
[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.
1 parent 22bb9a3 commit 977c3de

8 files changed

Lines changed: 21 additions & 23 deletions

File tree

concepts/string-methods/about.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ This may include letters, diacritical marks, positioning characters, numbers, cu
66
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.
77
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.
88

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.
1011

1112
To further work with strings, Python provides a rich set of [string methods][str-methods] for searching, cleaning, transforming, translating, and many other operations.
1213

1314
Some of the more commonly used `str` methods include:
1415

15-
- Checking for prefixes/suffixes with `startswith(<substr>)` and `endswith(<substr>)`
16+
- Checking for prefixes/suffixes with `<str>.startswith(<substr>)` and `<str>.endswith(<substr>)`
1617
- Altering string casing with methods like `<str>.title()`, `<str>.upper()`/`<str>.lower()`, and `<str>.swapcase()`
1718
- Removing leading or trailing characters from a string using `<str>.strip(<chars>)`, `<str>.lstrip(<chars>)`, or `<str>.rstrip(<chars>)`
1819
- Replacing substrings with the `<str>.replace(<old>, <new>)` method
@@ -33,7 +34,7 @@ True
3334
>>> 'Do you want to 💃?'.endswith('💃')
3435
False
3536

36-
>> 'The quick brown fox jumped over the lazy dog.'.endswith('dog')
37+
>>> 'The quick brown fox jumped over the lazy dog.'.endswith('dog')
3738
False
3839
```
3940

@@ -117,7 +118,7 @@ Just the place for a Snark! I have said it thrice:
117118
'book keeper'
118119
```
119120

120-
:star:**Newly added in Python `3.9`**
121+
🌟**Newly added in Python `3.9`**
121122

122123
Python `3.9` introduces two new string methods that make removing prefixes and suffixes much easier.
123124

@@ -144,7 +145,7 @@ Python `3.9` introduces two new string methods that make removing prefixes and s
144145
For more examples and methods the [informal tutorial][informal tutorial] is a nice jumping-off point.
145146
[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.
146147

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.
148149

149150

150151
[Lewis Carroll]: https://www.poetryfoundation.org/poets/lewis-carroll

concepts/strings/about.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ A `str` in Python is an [immutable sequence][text sequence] of [Unicode code poi
44
These may include letters, diacritical marks, positioning characters, numbers, currency symbols, emoji, punctuation, space and line break characters, and more.
55

66
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.
88

99
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.
1010
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.
1111

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.
1314

1415

1516
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
101102
True
102103
```
103104

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.
105106
Results exclude the `stop` index.
106107
If no `start` is given, the starting index will be 0.
107108
If no `stop` is given, the `stop` index will be the end of the string.

concepts/strings/introduction.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ These could include letters, diacritical marks, positioning characters, numbers,
55

66
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.
77

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.
910

1011
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`.
1112

1213
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.
1415

1516

1617
[common sequence operations]: https://docs.python.org/3/library/stdtypes.html#common-sequence-operations

exercises/concept/little-sisters-essay/.meta/exemplar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def clean_up_spacing(sentence):
3131
"""Trim any leading or trailing whitespace from the sentence.
3232
3333
Parameters:
34-
sentence (str): A sentence to clean of leading and trailing space characters.
34+
sentence (str): A sentence to clean of leading and trailing space characters.
3535
3636
Returns:
3737
str: A sentence that has been cleaned of leading and trailing space characters.

exercises/concept/little-sisters-essay/string_methods.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def clean_up_spacing(sentence):
3131
"""Trim any leading or trailing whitespace from the sentence.
3232
3333
Parameters:
34-
sentence (str): A sentence to clean of leading and trailing space characters.
34+
sentence (str): A sentence to clean of leading and trailing space characters.
3535
3636
Returns:
3737
str: A sentence that has been cleaned of leading and trailing space characters.

exercises/concept/little-sisters-vocab/.docs/hints.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,11 @@ There's four activities in the assignment, each with a set of text or words to w
1919
- 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.
2020
- 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`.
2121

22-
2322
## 3. Remove a suffix from a word
2423

2524
- 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`
2827

2928
## 4. Extract and transform a word
3029

exercises/concept/little-sisters-vocab/.meta/exemplar.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,10 @@ def make_word_groups(vocab_words):
2121
vocab_words (list[str]): Vocabulary words with prefix at first index.
2222
2323
Returns:
24-
str: Prefix followed by vocabulary words with
25-
prefix applied.
24+
str: Prefix followed by vocabulary words with prefix applied.
2625
2726
This function takes a `vocab_words` list of strings and returns a string
28-
with the prefix and the words with prefix applied, separated
29-
by ' :: '.
27+
with the prefix and the words with prefix applied, separated by ' :: '.
3028
3129
Examples:
3230
>>> list('en', 'close', 'joy', 'lighten')

exercises/concept/little-sisters-vocab/strings.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,10 @@ def make_word_groups(vocab_words):
2121
vocab_words (list[str]): Vocabulary words with prefix at first index.
2222
2323
Returns:
24-
str: Prefix followed by vocabulary words with
25-
prefix applied.
24+
str: Prefix followed by vocabulary words with prefix applied.
2625
2726
This function takes a `vocab_words` list of strings and returns a string
28-
with the prefix and the words with prefix applied, separated
29-
by ' :: '.
27+
with the prefix and the words with prefix applied, separated by ' :: '.
3028
3129
Examples:
3230
>>> list('en', 'close', 'joy', 'lighten')

0 commit comments

Comments
 (0)