Skip to content

Commit bf42c5d

Browse files
authored
[Python 3.13.5] Upgrade Cleanup & Fixes (#4100)
* Small fixes in code examples and explainations from forum, messages, and review. * Small fixes and corrections from forum, gh issues and code reviews. * Bumped version to ubuntu-24.04 in CI for canonical_sync tests.
1 parent 218e87e commit bf42c5d

File tree

15 files changed

+43
-28
lines changed

15 files changed

+43
-28
lines changed

.github/workflows/ci-workflow.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
./bin/template_status.py -v -p .problem-specifications
4949
5050
canonical_sync:
51-
runs-on: ubuntu-22.04
51+
runs-on: ubuntu-24.04
5252
needs: housekeeping
5353
strategy:
5454
matrix:

concepts/basics/about.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,16 @@ TypeError: raise_to_power() missing 1 required positional argument: 'power'
228228
>>> str.upper(start_text) # Calling the upper() method from the built-in str class on start_text.
229229
'MY SILLY SENTENCE FOR EXAMPLES.'
230230

231+
# Because a string is an instance of the str class, methods can also be called on them "directly".
232+
>>> start_text = "my silly sentence for examples."
233+
>>> start_text.upper() # Calling the upper() method on start_text directly.
234+
'MY SILLY SENTENCE FOR EXAMPLES.'
235+
236+
# Alternatively, we can skip the variable assignment (although this gets messy quick).
237+
>>> "my silly sentence for examples.".upper()
238+
'MY SILLY SENTENCE FOR EXAMPLES.'
239+
240+
231241
# Importing the math module
232242
import math
233243

concepts/bools/about.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# About
22

3-
Python represents true and false values with the [`bool`][bools] type, which is a subtype of `int`.
3+
Python represents true and false values with the [`bool`][bools] type, which is a subclass of `int`.
44
There are only two Boolean values in this type: `True` and `False`.
55
These values can be assigned to a variable and combined with the [Boolean operators][boolean-operators] (`and`, `or`, `not`):
66

@@ -134,10 +134,8 @@ It is considered a [Python anti-pattern][comparing to true in the wrong way] to
134134
```
135135

136136

137-
[bool-function]: https://docs.python.org/3/library/functions.html#bool
138-
[bool]: https://docs.python.org/3/library/stdtypes.html#truth
139137
[Boolean-operators]: https://docs.python.org/3/library/stdtypes.html#boolean-operations-and-or-not
138+
[bool-function]: https://docs.python.org/3/library/functions.html#bool
139+
[bools]: https://docs.python.org/3/library/stdtypes.html#typebool
140140
[comparing to true in the wrong way]: https://docs.quantifiedcode.com/python-anti-patterns/readability/comparison_to_true.html
141141
[comparisons]: https://docs.python.org/3/library/stdtypes.html#comparisons
142-
143-
[bools]: https://docs.python.org/3/library/stdtypes.html#typebool

concepts/bools/introduction.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Introduction
22

3-
Python represents true and false values with the [`bool`][bools] type, which is a subtype of `int`.
3+
Python represents true and false values with the [`bool`][bools] type, which is a subclass of `int`.
44
There are only two values under that type: `True` and `False`.
55
These values can be bound to a variable:
66

@@ -22,4 +22,4 @@ We can evaluate Boolean expressions using the `and`, `or`, and `not` operators.
2222
>>> false_variable = not True
2323
```
2424

25-
[bools]: https://docs.python.org/3/library/stdtypes.html#typebool
25+
[bools]: https://docs.python.org/3/library/stdtypes.html#typebool

concepts/dicts/about.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ animals = {
108108
## Accessing Values in a `dict`
109109

110110
You can access a `value` in a dictionary using a _key_ in square brackets.
111-
If a key does not exist, a `KeyError` is thrown:
111+
If a key does not exist in the dictionary, a `KeyError` is thrown:
112112

113113
```python
114114
>>> bear["speed"]

concepts/sets/about.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ The operator version of this method is `<set> & <other set> & <other set 2> & .
385385

386386
>>> herbs = ['Annatto','Asafetida','Basil','Chervil','Cilantro',
387387
'Curry Leaf','Fennel','Kaffir Lime','Lavender',
388-
'Marjoram','Mint','Oregano','Summer Savory'
388+
'Marjoram','Mint','Oregano','Summer Savory',
389389
'Tarragon','Wild Bergamot','Wild Celery',
390390
'Winter Savory']
391391

@@ -420,8 +420,8 @@ The operator version of this method is `<set> ^ <other set>`.
420420
>>> fruit_and_flowers ^ plants_1
421421
{'🌲', '🌸', '🌴', '🌵','🌺', '🌻'}
422422

423-
>>> fruit_and_flowers ^ plants_2
424-
{ '🥑', '🌴','🌲', '🌵', '🍈', '🥭'}
423+
>>> fruit_and_flowers ^ set(plants_2)
424+
{'🥭', '🌴', '🌵', '🍈', '🌲', '🥑'}
425425
```
426426

427427
~~~~exercism/note

concepts/strings/about.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ A `str` literal can be declared via single `'` or double `"` quotes. The escape
1818

1919
>>> single_quoted = 'These allow "double quoting" without "escape" characters.'
2020

21-
>>> double_quoted = "These allow embedded 'single quoting', so you don't have to use an 'escape' character".
21+
>>> double_quoted = "These allow embedded 'single quoting', so you don't have to use an 'escape' character."
2222
```
2323

2424

exercises/concept/black-jack/black_jack.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def higher_card(card_one, card_two):
3434

3535

3636
def value_of_ace(card_one, card_two):
37-
"""Calculate the most advantageous value for the ace card.
37+
"""Calculate the most advantageous value for an upcoming ace card.
3838
3939
:param card_one, card_two: str - card dealt. See below for values.
4040
:return: int - either 1 or 11 value of the upcoming ace card.

exercises/concept/cater-waiter/.docs/instructions.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,11 @@ Implement the `check_drinks(<drink_name>, <drink_ingredients>)` function that ta
4141
## 3. Categorize Dishes
4242

4343
The guest list includes diners with different dietary needs, and your staff will need to separate the dishes into Vegan, Vegetarian, Paleo, Keto, and Omnivore.
44+
A dish belongs to a category only if all of its ingredients appear in the category's ingredient set.
4445

4546
Implement the `categorize_dish(<dish_name>, <dish_ingredients>)` function that takes a dish name and a `set` of that dish's ingredients.
4647
The function should return a string with the `dish name: <CATEGORY>` (_which meal category the dish belongs to_).
47-
All dishes will "fit" into one of the categories imported from `sets_categories_data.py` (VEGAN, VEGETARIAN, PALEO, KETO, or OMNIVORE).
48+
All dishes given will "fit" into one of the categories imported from `sets_categories_data.py` (VEGAN, VEGETARIAN, PALEO, KETO, or OMNIVORE).
4849

4950
```python
5051
>>> from sets_categories_data import VEGAN, VEGETARIAN, PALEO, KETO, OMNIVORE

exercises/concept/cater-waiter/.docs/introduction.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ The operator version of this method is `<set> & <other set> & <other set 2> & ..
258258

259259
>>> herbs = ['Annatto','Asafetida','Basil','Chervil','Cilantro',
260260
'Curry Leaf','Fennel','Kaffir Lime','Lavender',
261-
'Marjoram','Mint','Oregano','Summer Savory'
261+
'Marjoram','Mint','Oregano','Summer Savory',
262262
'Tarragon','Wild Bergamot','Wild Celery',
263263
'Winter Savory']
264264

@@ -360,8 +360,8 @@ The operator version of this method is `<set> ^ <other set>`:
360360
>>> fruit_and_flowers ^ plants_1
361361
{'🌲', '🌸', '🌴', '🌵','🌺', '🌻'}
362362

363-
>>> fruit_and_flowers ^ plants_2
364-
{ '🥑', '🌴','🌲', '🌵', '🍈', '🥭'}
363+
>>> fruit_and_flowers ^ set(plants_2)
364+
{'🥭', '🌴', '🌵', '🍈', '🌲', '🥑'}
365365
```
366366

367367
~~~~exercism/note

0 commit comments

Comments
 (0)