Skip to content

Commit eb0e928

Browse files
authored
Corrected typos and grammar mistakes for docs and stubs. (exercism#4174)
1 parent 977c3de commit eb0e928

4 files changed

Lines changed: 30 additions & 32 deletions

File tree

concepts/loops/about.md

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ The keywords `break`, `continue`, and `else` help customize loop behavior.
3131
The basic [`for`][for statement] `loop` in Python is better described as a _`for each`_ which cycles through the values of any [iterable object][iterable], terminating when there are no values returned from calling [`next()`][next built-in] (_raising a [`StopIteration`][stopiteration]_).
3232

3333
```python
34-
3534
>>> word_list = ["bird", "chicken", "barrel", "bongo"]
3635

3736
>>> for word in word_list:
@@ -95,7 +94,6 @@ Interestingly, `range()` [_is not an iterator_][range is not an iterator], and c
9594
If both values and indexes are needed, the built-in [`enumerate(<iterable>)`][enumerate] will return an [`iterator`][iterator] over (`index`, `value`) pairs:
9695

9796
```python
98-
9997
>>> word_list = ["bird", "chicken", "barrel", "apple"]
10098

10199
# *index* and *word* are the loop variables.
@@ -152,15 +150,15 @@ The `enumerate(<iterable>)` function can also be set to `start` the index count
152150
The [`continue`][continue statement] keyword can be used to skip forward to the next iteration cycle:
153151

154152
```python
155-
word_list = ["bird", "chicken", "barrel", "bongo", "sliver", "apple", "bear"]
156-
157-
# This will skip *bird*, at index 0
158-
for index, word in enumerate(word_list):
159-
if index == 0:
160-
continue
161-
if word.startswith("b"):
162-
print(f"{word.title()} (at index {index}) starts with a b.")
163-
153+
>>> word_list = ["bird", "chicken", "barrel", "bongo", "sliver", "apple", "bear"]
154+
...
155+
... # This will skip *bird*, at index 0
156+
... for index, word in enumerate(word_list):
157+
... if index == 0:
158+
... continue
159+
... if word.startswith("b"):
160+
... print(f"{word.title()} (at index {index}) starts with a b.")
161+
...
164162
'Barrel (at index 2) starts with a b.'
165163
'Bongo (at index 3) starts with a b.'
166164
'Bear (at index 6) starts with a b.'
@@ -176,9 +174,9 @@ The [`break`][break statement] (_like in many C-related languages_) keyword can
176174
... if word.startswith("b"):
177175
... print(f"{word.title()} (at index {index}) starts with a B.")
178176
... elif word == "sliver":
179-
... break
177+
... break
180178
... else:
181-
... print(f"{word.title()} doesn't start with a B.")
179+
... print(f"{word.title()} doesn't start with a B.")
182180
... print("loop broken.")
183181
...
184182
'Bird (at index 0) starts with a B.'
@@ -202,11 +200,11 @@ The loop [`else` clause][loop else] is unique to Python and can be used for "wra
202200
... word = word.title()
203201
... if word.startswith("B"):
204202
... print(f"{word} (at index {index}) starts with a B.")
205-
206-
...# This executes once *StopIteration* is raised and
207-
...# there are no more items to iterate through.
208-
...# Note the indentation, which lines up with the for keyword.
209-
...else:
203+
...
204+
... # This executes once *StopIteration* is raised and
205+
... # There are no more items to iterate through.
206+
... # Note the indentation, which lines up with the for keyword.
207+
... else:
210208
... print(f"Found the above b-words, out of {len(word_list)} words in the word list.")
211209
...
212210
'Bird (at index 0) starts with a B.'
@@ -227,7 +225,7 @@ The loop [`else` clause][loop else] is unique to Python and can be used for "wra
227225

228226
... # This statement does not run, because a *break* was triggered.
229227
... else:
230-
... print(f"Found the above b-words, out of {len(word_list)} words in the word list.")
228+
... print(f"Found the above b-words, out of {len(word_list)} words in the word list.")
231229
...
232230
'Bird (at index 0) starts with a B.'
233231
'Barrel (at index 2) starts with a B.'

exercises/concept/making-the-grade/.docs/hints.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
## General
44

5-
- [`while`][while-loops] loops are used for _indefinite_ (uncounted) iteration
6-
- [`for`][for-loops] loops are used for _definite_, (counted) iteration.
5+
- [`while`][while-loops] loops are used for _indefinite_ (uncounted) iteration.
6+
- [`for`][for-loops] loops are used for _definite_ (counted) iteration.
77
- The keywords [`break` and `continue`][control flow] help customize loop behavior.
8-
- [`range(<start>, stop, <step>)`][range] can be used to generate a sequence for a loop counter.
8+
- [`range(<start>, <stop>, <step>)`][range] can be used to generate a sequence for a loop counter.
99
- The built-in [`enumerate()`][enumerate] will return (`<value>`, `<index>`) pairs to iterate over.
1010

1111
Also being familiar with the following can help with completing the tasks:
1212

13-
- [`lists`][list]: indexing, nested lists, [`<list>.append`][append and pop], [`<list>.pop()`][append and pop].
13+
- [`lists`][list]: indexing, nested lists, [`<list>.append()`][append and pop], [`<list>.pop()`][append and pop].
1414
- [`str`][str]: `str()` constructor, using the `+` to concatenate strings, optionally, [`f-strings`][f-strings].
1515

1616
## 1. Rounding Scores
@@ -22,7 +22,7 @@ Also being familiar with the following can help with completing the tasks:
2222
## 2. Non-Passing Students
2323

2424
- There's no need to declare `loop` counters or `index` counters when iterating through an object using a `for` loop.
25-
- A results counter does need to be set up and _incremented_ -- you'll want to `return` the count of non-passing students when the loop terminates.
25+
- A results counter does need to be set up and _incremented_ you'll want to `return` the count of non-passing students when the loop terminates.
2626

2727
## 3. The "Best"
2828

exercises/concept/making-the-grade/.meta/exemplar.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ def round_scores(student_scores):
55
"""Round all provided student scores.
66
77
Parameters:
8-
student_scores (list[float|int]): Student exam scores.
8+
student_scores (list[float]): Student exam scores.
99
1010
Returns:
1111
list[int]: Student scores *rounded* to the nearest integer value.
@@ -42,7 +42,7 @@ def above_threshold(student_scores, threshold):
4242
threshold (int): The threshold to cross to be the "best" score.
4343
4444
Returns:
45-
list[int]: Integer scores that are at or above the "best" threshold.
45+
list[int]: Integer scores that are at or above the "best" threshold.
4646
"""
4747

4848
above = []
@@ -57,7 +57,7 @@ def letter_grades(highest):
5757
"""Create a list of grade thresholds based on the provided highest grade.
5858
5959
Parameters:
60-
highest: int - value of the highest exam score.
60+
highest (int): The value of the highest exam score.
6161
6262
Returns:
6363
list[int]: Lower threshold scores for each D-A letter grade interval.
@@ -85,7 +85,7 @@ def student_ranking(student_scores, student_names):
8585
student_names (list[str]): Student names by exam score in descending order.
8686
8787
Returns:
88-
list[str]: Strings in format ["<rank>. <student name>: <score>"].
88+
list[str]: Strings in format ["<rank>. <student name>: <score>"].
8989
"""
9090

9191
results = []

exercises/concept/making-the-grade/loops.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ def round_scores(student_scores):
55
"""Round all provided student scores.
66
77
Parameters:
8-
student_scores (list[float|int]): Student exam scores.
8+
student_scores (list[float]): Student exam scores.
99
1010
Returns:
1111
list[int]: Student scores *rounded* to the nearest integer value.
@@ -35,7 +35,7 @@ def above_threshold(student_scores, threshold):
3535
threshold (int): The threshold to cross to be the "best" score.
3636
3737
Returns:
38-
list[int]: Integer scores that are at or above the "best" threshold.
38+
list[int]: Integer scores that are at or above the "best" threshold.
3939
"""
4040

4141
pass
@@ -45,7 +45,7 @@ def letter_grades(highest):
4545
"""Create a list of grade thresholds based on the provided highest grade.
4646
4747
Parameters:
48-
highest: int - value of the highest exam score.
48+
highest (int): The value of the highest exam score.
4949
5050
Returns:
5151
list[int]: Lower threshold scores for each D-A letter grade interval.
@@ -69,7 +69,7 @@ def student_ranking(student_scores, student_names):
6969
student_names (list[str]): Student names by exam score in descending order.
7070
7171
Returns:
72-
list[str]: Strings in format ["<rank>. <student name>: <score>"].
72+
list[str]: Strings in format ["<rank>. <student name>: <score>"].
7373
"""
7474

7575
pass

0 commit comments

Comments
 (0)