Skip to content

Commit cf5931b

Browse files
committed
Typo and formatting corrections for lists and comparisons and corresponding exercises.
1 parent ff82bc0 commit cf5931b

7 files changed

Lines changed: 33 additions & 33 deletions

File tree

‎concepts/comparisons/about.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ The table below shows the most common Python comparison operators:
1313
| `<=` | "less than or equal to" | `a <= b` is `True` if `a < b` or `a == b` in value |
1414
| `!=` | "not equal to" | `a != b` is `True` if `a == b` is `False` |
1515
| `is` | "identity" | `a is b` is `True` if **_and only if_** `a` and `b` are the same _object_ |
16-
| `is not` | "negated identity" | `a is not b` is `True` if `a` and `b` are **not** the same _object_ |
16+
| `is not` | "negated identity" | `a is not b` is `True` if **_and only if_** `a` and `b` are **not** the same _object_ |
1717
| `in` | "containment test" | `a in b` is `True` if `a` is member, subset, or element of `b` |
1818
| `not in` | "negated containment test" | `a not in b` is `True` if `a` is not a member, subset, or element of `b` |
1919

@@ -146,7 +146,7 @@ True
146146

147147
Comparison operators can be chained _arbitrarily_.
148148
Note that the evaluation of an expression takes place from `left` to `right`.
149-
For example, `x < y <= z` is equivalent to `x < y` `and` `y <= z`, except that `y` is evaluated **only once**.
149+
For example, `x < y <= z` is equivalent to `x < y and y <= z`, except that `y` is evaluated **only once**.
150150
In both cases, `z` is _not_ evaluated **at all** when `x < y` is found to be `False`.
151151
This is often called `short-circuit evaluation` - the evaluation stops if the truth value of the expression has already been determined.
152152

@@ -180,7 +180,7 @@ Due to their singleton status, `None` and `NotImplemented` should always be comp
180180
See the Python reference docs on [value comparisons][value comparisons none] and [PEP8][PEP8 programming recommendations] for more details on this convention.
181181

182182
```python
183-
>>>
183+
184184
# A list of favorite numbers.
185185
>>> my_fav_numbers = [1, 2, 3]
186186

@@ -218,7 +218,7 @@ The operators `in` and `not in` test for _membership_.
218218
For string and bytes types, `<name> in <fullname>` is `True` _**if and only if**_ `<name>` is a substring of `<fullname>`.
219219

220220
```python
221-
>>>
221+
222222
# A set of lucky numbers.
223223
>>> lucky_numbers = {11, 22, 33}
224224
>>> 22 in lucky_numbers

‎concepts/comparisons/introduction.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ The table below shows the most common Python comparison operators:
1313
| `<=` | "less than or equal to" | `a <= b` is `True` if `a < b` or `a == b` in value |
1414
| `!=` | "not equal to" | `a != b` is `True` if `a == b` is `False` |
1515
| `is` | "identity" | `a is b` is `True` if **_and only if_** `a` and `b` are the same _object_ |
16-
| `is not` | "negated identity" | `a is not b` is `True` if `a` and `b` are **not** the same _object_ |
16+
| `is not` | "negated identity" | `a is not b` is `True` if **_and only if_** `a` and `b` are **not** the same _object_ |
1717
| `in` | "containment test" | `a in b` is `True` if `a` is member, subset, or element of `b` |
1818
| `not in` | "negated containment test" | `a not in b` is `True` if `a` is not a member, subset, or element of `b` |
1919

‎concepts/lists/about.md‎

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -49,26 +49,26 @@ For readability, line breaks can be used when there are many elements or nested
4949

5050
```python
5151
>>> lots_of_entries = [
52-
"Rose",
53-
"Sunflower",
54-
"Poppy",
55-
"Pansy",
56-
"Tulip",
57-
"Fuchsia",
58-
"Cyclamen",
59-
"Lavender"
60-
]
52+
... "Rose",
53+
... "Sunflower",
54+
... "Poppy",
55+
... "Pansy",
56+
... "Tulip",
57+
... "Fuchsia",
58+
... "Cyclamen",
59+
... "Lavender"
60+
... ]
6161

6262
>>> lots_of_entries
6363
['Rose', 'Sunflower', 'Poppy', 'Pansy', 'Tulip', 'Fuchsia', 'Cyclamen', 'Lavender']
6464

6565

6666
# Each data structure is on its own line to help clarify what they are.
6767
>>> nested_data_structures = [
68-
{"fish": "gold", "monkey": "brown", "parrot": "grey"},
69-
("fish", "mammal", "bird"),
70-
['water', 'jungle', 'sky']
71-
]
68+
... {"fish": "gold", "monkey": "brown", "parrot": "grey"},
69+
... ("fish", "mammal", "bird"),
70+
... ['water', 'jungle', 'sky']
71+
... ]
7272

7373
>>> nested_data_structures
7474
[{'fish': 'gold', 'monkey': 'brown', 'parrot': 'grey'}, ('fish', 'mammal', 'bird'), ['water', 'jungle', 'sky']]
@@ -174,7 +174,7 @@ Indexes can be from **`left`** --> **`right`** (_starting at zero_) or **`right`
174174
'Toast'
175175
```
176176

177-
A section of a list can be accessed via _slice notation_ (`<list>[start:stop]`).
177+
A section of a list can be accessed via _slice notation_ (`<list>[<start>:<stop>]`).
178178
A _slice_ is defined as an element sequence at position `index`, such that `start <= index < stop`.
179179
[_Slicing_][slice notation] returns a copy of the "sliced" items and does not modify the original `list`.
180180

@@ -207,7 +207,7 @@ Lists supply an [_iterator_][iterator], and can be looped through/over in the sa
207207
>>> colors = ["Orange", "Green", "Grey", "Blue"]
208208
>>> for item in colors:
209209
... print(item)
210-
...
210+
211211
Orange
212212
Green
213213
Grey
@@ -218,7 +218,7 @@ Blue
218218
>>> colors = ["Orange", "Green", "Grey", "Blue"]
219219
>>> for index, item in enumerate(colors):
220220
... print(item, ":", index)
221-
...
221+
222222
Orange : 0
223223
Green : 1
224224
Grey : 2
@@ -229,7 +229,7 @@ Blue : 3
229229
>>> numbers_to_cube = [5, 13, 12, 16]
230230
>>> for number in numbers_to_cube:
231231
... print(number**3)
232-
...
232+
233233
125
234234
2197
235235
1728
@@ -335,7 +335,7 @@ This reference complication becomes exacerbated when working with nested or mult
335335
from pprint import pprint
336336

337337
# This will produce a game grid that is 8x8, pre-populated with zeros.
338-
>>> game_grid = [[0]*8] *8
338+
>>> game_grid = [[0]*8]*8
339339

340340
>>> pprint(game_grid)
341341
[[0, 0, 0, 0, 0, 0, 0, 0],

‎exercises/concept/black-jack/.meta/exemplar.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def value_of_card(card):
1212
card (str): The given card.
1313
1414
Returns:
15-
int: The value of a given card. See below for values.
15+
int: The value of a given card. See below for values.
1616
1717
1. 'J', 'Q', or 'K' (otherwise known as "face cards") = 10
1818
2. 'A' (ace card) = 1
@@ -43,7 +43,7 @@ def higher_card(card_one, card_two):
4343
3. '2' - '10' = numerical value.
4444
4545
Returns:
46-
str or tuple: The resulting Tuple contains both cards if they are of equal value.
46+
str or tuple: The resulting tuple contains both cards if they are of equal value.
4747
"""
4848

4949
card_one_value = value_of_card(card_one)

‎exercises/concept/black-jack/black_jack.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def value_of_card(card):
1212
card (str): The given card.
1313
1414
Returns:
15-
int: The value of a given card. See below for values.
15+
int: The value of a given card. See below for values.
1616
1717
1. 'J', 'Q', or 'K' (otherwise known as "face cards") = 10
1818
2. 'A' (ace card) = 1
@@ -34,7 +34,7 @@ def higher_card(card_one, card_two):
3434
3. '2' - '10' = numerical value.
3535
3636
Returns:
37-
str or tuple: The resulting Tuple contains both cards if they are of equal value.
37+
str or tuple: The resulting tuple contains both cards if they are of equal value.
3838
"""
3939

4040
pass

‎exercises/concept/card-games/.meta/exemplar.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def get_rounds(number):
88
"""Create a list containing the current and next two round numbers.
99
1010
Parameters:
11-
number (int): The current round number.
11+
number (int): The current round number.
1212
1313
Returns:
1414
list: The current round number and the two that follow.
@@ -21,7 +21,7 @@ def concatenate_rounds(rounds_1, rounds_2):
2121
"""Concatenate two lists of round numbers.
2222
2323
Parameters:
24-
rounds_1 (list): The first rounds played.
24+
rounds_1 (list): The first rounds played.
2525
rounds_2 (list): The second group of rounds played.
2626
2727
Returns:
@@ -35,7 +35,7 @@ def list_contains_round(rounds, number):
3535
"""Check if the list of rounds contains the specified number.
3636
3737
Parameters:
38-
rounds (list): The rounds played.
38+
rounds (list): The rounds played.
3939
number (int): The round number.
4040
4141
Returns:

‎exercises/concept/card-games/lists.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def get_rounds(number):
88
"""Create a list containing the current and next two round numbers.
99
1010
Parameters:
11-
number (int): The current round number.
11+
number (int): The current round number.
1212
1313
Returns:
1414
list: The current round number and the two that follow.
@@ -21,7 +21,7 @@ def concatenate_rounds(rounds_1, rounds_2):
2121
"""Concatenate two lists of round numbers.
2222
2323
Parameters:
24-
rounds_1 (list): The first rounds played.
24+
rounds_1 (list): The first rounds played.
2525
rounds_2 (list): The second group of rounds played.
2626
2727
Returns:
@@ -35,7 +35,7 @@ def list_contains_round(rounds, number):
3535
"""Check if the list of rounds contains the specified number.
3636
3737
Parameters:
38-
rounds (list): The rounds played.
38+
rounds (list): The rounds played.
3939
number (int): The round number.
4040
4141
Returns:

0 commit comments

Comments
 (0)