From 2ac723be84944a1a56fc90622798836a2f2f8d0b Mon Sep 17 00:00:00 2001 From: BethanyG Date: Tue, 24 Feb 2026 16:10:19 -0800 Subject: [PATCH 1/3] Small fixes in code examples and explainations from forum, messages, and review. --- concepts/basics/about.md | 10 ++++++++++ concepts/bools/about.md | 8 +++----- concepts/bools/introduction.md | 4 ++-- concepts/dicts/about.md | 2 +- concepts/sets/about.md | 6 +++--- concepts/strings/about.md | 2 +- 6 files changed, 20 insertions(+), 12 deletions(-) diff --git a/concepts/basics/about.md b/concepts/basics/about.md index 4a1a93e0e80..71f30524c4d 100644 --- a/concepts/basics/about.md +++ b/concepts/basics/about.md @@ -228,6 +228,16 @@ TypeError: raise_to_power() missing 1 required positional argument: 'power' >>> str.upper(start_text) # Calling the upper() method from the built-in str class on start_text. 'MY SILLY SENTENCE FOR EXAMPLES.' +# Because a string is an instance of the str class, methods can also be called on them "directly". +>>> start_text = "my silly sentence for examples." +>>> start_text.upper() # Calling the upper() method on start_text directly. +'MY SILLY SENTENCE FOR EXAMPLES.' + +# Alternatively, we can skip the variable assignment (although this gets messy quick). +>>> "my silly sentence for examples.".upper() +'MY SILLY SENTENCE FOR EXAMPLES.' + + # Importing the math module import math diff --git a/concepts/bools/about.md b/concepts/bools/about.md index a2680fc06b3..0b8354750a3 100644 --- a/concepts/bools/about.md +++ b/concepts/bools/about.md @@ -1,6 +1,6 @@ # About -Python represents true and false values with the [`bool`][bools] type, which is a subtype of `int`. +Python represents true and false values with the [`bool`][bools] type, which is a subclass of `int`. There are only two Boolean values in this type: `True` and `False`. These values can be assigned to a variable and combined with the [Boolean operators][boolean-operators] (`and`, `or`, `not`): @@ -134,10 +134,8 @@ It is considered a [Python anti-pattern][comparing to true in the wrong way] to ``` -[bool-function]: https://docs.python.org/3/library/functions.html#bool -[bool]: https://docs.python.org/3/library/stdtypes.html#truth [Boolean-operators]: https://docs.python.org/3/library/stdtypes.html#boolean-operations-and-or-not +[bool-function]: https://docs.python.org/3/library/functions.html#bool +[bools]: https://docs.python.org/3/library/stdtypes.html#typebool [comparing to true in the wrong way]: https://docs.quantifiedcode.com/python-anti-patterns/readability/comparison_to_true.html [comparisons]: https://docs.python.org/3/library/stdtypes.html#comparisons - -[bools]: https://docs.python.org/3/library/stdtypes.html#typebool \ No newline at end of file diff --git a/concepts/bools/introduction.md b/concepts/bools/introduction.md index af24137025e..85eb032df25 100644 --- a/concepts/bools/introduction.md +++ b/concepts/bools/introduction.md @@ -1,6 +1,6 @@ # Introduction -Python represents true and false values with the [`bool`][bools] type, which is a subtype of `int`. +Python represents true and false values with the [`bool`][bools] type, which is a subclass of `int`. There are only two values under that type: `True` and `False`. These values can be bound to a variable: @@ -22,4 +22,4 @@ We can evaluate Boolean expressions using the `and`, `or`, and `not` operators. >>> false_variable = not True ``` -[bools]: https://docs.python.org/3/library/stdtypes.html#typebool \ No newline at end of file +[bools]: https://docs.python.org/3/library/stdtypes.html#typebool diff --git a/concepts/dicts/about.md b/concepts/dicts/about.md index 72ea9079c6d..1f83fe6e30a 100644 --- a/concepts/dicts/about.md +++ b/concepts/dicts/about.md @@ -108,7 +108,7 @@ animals = { ## Accessing Values in a `dict` You can access a `value` in a dictionary using a _key_ in square brackets. -If a key does not exist, a `KeyError` is thrown: +If a key does not exist in the dictionary, a `KeyError` is thrown: ```python >>> bear["speed"] diff --git a/concepts/sets/about.md b/concepts/sets/about.md index 204df380577..2c011c14471 100644 --- a/concepts/sets/about.md +++ b/concepts/sets/about.md @@ -385,7 +385,7 @@ The operator version of this method is ` & & & . >>> herbs = ['Annatto','Asafetida','Basil','Chervil','Cilantro', 'Curry Leaf','Fennel','Kaffir Lime','Lavender', - 'Marjoram','Mint','Oregano','Summer Savory' + 'Marjoram','Mint','Oregano','Summer Savory', 'Tarragon','Wild Bergamot','Wild Celery', 'Winter Savory'] @@ -420,8 +420,8 @@ The operator version of this method is ` ^ `. >>> fruit_and_flowers ^ plants_1 {'🌲', '🌸', '🌴', '🌵','🌺', '🌻'} ->>> fruit_and_flowers ^ plants_2 -{ '🥑', '🌴','🌲', '🌵', '🍈', '🥭'} +>>> fruit_and_flowers ^ set(plants_2) +{'🥭', '🌴', '🌵', '🍈', '🌲', '🥑'} ``` ~~~~exercism/note diff --git a/concepts/strings/about.md b/concepts/strings/about.md index 064c4c11bcb..227a252e821 100644 --- a/concepts/strings/about.md +++ b/concepts/strings/about.md @@ -18,7 +18,7 @@ A `str` literal can be declared via single `'` or double `"` quotes. The escape >>> single_quoted = 'These allow "double quoting" without "escape" characters.' ->>> double_quoted = "These allow embedded 'single quoting', so you don't have to use an 'escape' character". +>>> double_quoted = "These allow embedded 'single quoting', so you don't have to use an 'escape' character." ``` From fedf5b1d1b54463bd576ecbad89e6cb9ff49f089 Mon Sep 17 00:00:00 2001 From: BethanyG Date: Tue, 24 Feb 2026 16:19:49 -0800 Subject: [PATCH 2/3] Small fixes and corrections from forum, gh issues and code reviews. --- exercises/concept/black-jack/black_jack.py | 2 +- .../concept/cater-waiter/.docs/instructions.md | 3 ++- .../concept/cater-waiter/.docs/introduction.md | 6 +++--- .../concept/ellens-alien-game/classes_test.py | 16 ++++++++++------ .../.docs/introduction.md | 2 +- .../.docs/introduction.md | 4 +++- .../inventory-management/.docs/introduction.md | 2 +- .../little-sisters-vocab/.docs/introduction.md | 2 +- 8 files changed, 22 insertions(+), 15 deletions(-) diff --git a/exercises/concept/black-jack/black_jack.py b/exercises/concept/black-jack/black_jack.py index 9ce6ca5ba4d..9d99e11a8f1 100644 --- a/exercises/concept/black-jack/black_jack.py +++ b/exercises/concept/black-jack/black_jack.py @@ -34,7 +34,7 @@ def higher_card(card_one, card_two): def value_of_ace(card_one, card_two): - """Calculate the most advantageous value for the ace card. + """Calculate the most advantageous value for an upcoming ace card. :param card_one, card_two: str - card dealt. See below for values. :return: int - either 1 or 11 value of the upcoming ace card. diff --git a/exercises/concept/cater-waiter/.docs/instructions.md b/exercises/concept/cater-waiter/.docs/instructions.md index b0a9e1f855e..4ed51a444d5 100644 --- a/exercises/concept/cater-waiter/.docs/instructions.md +++ b/exercises/concept/cater-waiter/.docs/instructions.md @@ -41,10 +41,11 @@ Implement the `check_drinks(, )` function that ta ## 3. Categorize Dishes 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. +A dish belongs to a category only if all of its ingredients appear in the category's ingredient set. Implement the `categorize_dish(, )` function that takes a dish name and a `set` of that dish's ingredients. The function should return a string with the `dish name: ` (_which meal category the dish belongs to_). -All dishes will "fit" into one of the categories imported from `sets_categories_data.py` (VEGAN, VEGETARIAN, PALEO, KETO, or OMNIVORE). +All dishes given will "fit" into one of the categories imported from `sets_categories_data.py` (VEGAN, VEGETARIAN, PALEO, KETO, or OMNIVORE). ```python >>> from sets_categories_data import VEGAN, VEGETARIAN, PALEO, KETO, OMNIVORE diff --git a/exercises/concept/cater-waiter/.docs/introduction.md b/exercises/concept/cater-waiter/.docs/introduction.md index 0993c4f0aa2..dd5cc106ea9 100644 --- a/exercises/concept/cater-waiter/.docs/introduction.md +++ b/exercises/concept/cater-waiter/.docs/introduction.md @@ -258,7 +258,7 @@ The operator version of this method is ` & & & .. >>> herbs = ['Annatto','Asafetida','Basil','Chervil','Cilantro', 'Curry Leaf','Fennel','Kaffir Lime','Lavender', - 'Marjoram','Mint','Oregano','Summer Savory' + 'Marjoram','Mint','Oregano','Summer Savory', 'Tarragon','Wild Bergamot','Wild Celery', 'Winter Savory'] @@ -360,8 +360,8 @@ The operator version of this method is ` ^ `: >>> fruit_and_flowers ^ plants_1 {'🌲', '🌸', '🌴', '🌵','🌺', '🌻'} ->>> fruit_and_flowers ^ plants_2 -{ '🥑', '🌴','🌲', '🌵', '🍈', '🥭'} +>>> fruit_and_flowers ^ set(plants_2) +{'🥭', '🌴', '🌵', '🍈', '🌲', '🥑'} ``` ~~~~exercism/note diff --git a/exercises/concept/ellens-alien-game/classes_test.py b/exercises/concept/ellens-alien-game/classes_test.py index 3d2b986be4d..a73e652cfa5 100644 --- a/exercises/concept/ellens-alien-game/classes_test.py +++ b/exercises/concept/ellens-alien-game/classes_test.py @@ -198,15 +198,19 @@ def test_new_aliens_collection(self): test_data = [(-2, 6), (1, 5), (-4, -3)] actual_result = new_aliens_collection(test_data) + length_message = (f'We called your function with a list of coordinates that was' + f' {len(test_data)} items long, but the list of Alien ' + f'objects returned was {len(actual_result)} items long.') - error_message = "new_aliens_collection() must return a list of Alien objects." + self.assertEqual(len(test_data), len(actual_result), msg=length_message) for obj in actual_result: - self.assertIsInstance(obj, Alien, msg=error_message) + object_message = "new_aliens_collection() must return a list of Alien objects." + self.assertIsInstance(obj, Alien, msg=object_message) for position, obj in zip(test_data, actual_result): - position_error = (f'After calling new_aliens_collection({test_data}), ' - f'found {obj} initialized to position {(obj.x_coordinate, obj.y_coordinate)}, ' - f'but the tests expected {obj} to be at position {position} instead.') + position_message = (f'After calling new_aliens_collection({test_data}), ' + f'found {obj} initialized to position {(obj.x_coordinate, obj.y_coordinate)}, ' + f'but the tests expected {obj} to be at position {position} instead.') - self.assertEqual(position, (obj.x_coordinate, obj.y_coordinate), msg=position_error) + self.assertEqual(position, (obj.x_coordinate, obj.y_coordinate), msg=position_message) diff --git a/exercises/concept/ghost-gobble-arcade-game/.docs/introduction.md b/exercises/concept/ghost-gobble-arcade-game/.docs/introduction.md index a0743f7a115..994c0c39cb8 100644 --- a/exercises/concept/ghost-gobble-arcade-game/.docs/introduction.md +++ b/exercises/concept/ghost-gobble-arcade-game/.docs/introduction.md @@ -1,6 +1,6 @@ # Introduction -Python represents true and false values with the [`bool`][bools] type, which is a subtype of `int`. +Python represents true and false values with the [`bool`][bools] type, which is a subclass of `int`. There are only two values in this type: `True` and `False`. These values can be bound to a variable: diff --git a/exercises/concept/guidos-gorgeous-lasagna/.docs/introduction.md b/exercises/concept/guidos-gorgeous-lasagna/.docs/introduction.md index b4bd6de8533..eb755bcfe23 100644 --- a/exercises/concept/guidos-gorgeous-lasagna/.docs/introduction.md +++ b/exercises/concept/guidos-gorgeous-lasagna/.docs/introduction.md @@ -18,12 +18,13 @@ This first exercise introduces 4 major Python language features: ~~~~exercism/note -In general, content, tests, and analyzer tooling for the Python track follow the style conventions outlined in [PEP 8](https://www.python.org/dev/peps/pep-0008/) and [PEP 257](https://www.python.org/dev/peps/pep-0257/) for Python code style, with the additional (strong) suggestion that there be no single letter variable names. +In general, content, tests, and analyzer tooling for the Python track follow the style conventions outlined in [PEP 8](https://www.python.org/dev/peps/pep-0008/) and [PEP 257](https://www.python.org/dev/peps/pep-0257/) for Python code style, with the additional (strong) suggestion that there be no single letter variable names or variables named ["_"][uses of _ in Python]. On the Python track, [variables][variables] are always written in [`snake_case`][snake case], and constants in `SCREAMING_SNAKE_CASE`. [variables]: https://realpython.com/python-variables/ [snake case]: https://en.wikipedia.org/wiki/Snake_case +[uses of _ in Python]: https://medium.com/better-programming/how-to-use-underscore-properly-in-python-37df5e05ba4c ~~~~
@@ -184,6 +185,7 @@ TypeError: raise_to_power() missing 1 required positional argument: 'power' >>> str.upper(start_text) # Calling the upper() method from the built-in str class on start_text. 'MY SILLY SENTENCE FOR EXAMPLES.' + # Importing the math module import math diff --git a/exercises/concept/inventory-management/.docs/introduction.md b/exercises/concept/inventory-management/.docs/introduction.md index 161b1d0e7cc..4671d985766 100644 --- a/exercises/concept/inventory-management/.docs/introduction.md +++ b/exercises/concept/inventory-management/.docs/introduction.md @@ -49,7 +49,7 @@ A `dict` can also be directly entered as a _dictionary literal_, using curly bra ## Accessing Values in a Dictionary You can access an entry in a dictionary using a _key_ in square (`[]`) brackets. -If a `key` does not exist n the `dict`, a `KeyError` is thrown: +If a `key` does not exist in the `dict`, a `KeyError` is thrown: ```python >>> bear["speed"] diff --git a/exercises/concept/little-sisters-vocab/.docs/introduction.md b/exercises/concept/little-sisters-vocab/.docs/introduction.md index 3b7ee76b275..db6090fa8ad 100644 --- a/exercises/concept/little-sisters-vocab/.docs/introduction.md +++ b/exercises/concept/little-sisters-vocab/.docs/introduction.md @@ -12,7 +12,7 @@ A `str` literal can be declared via single `'` or double `"` quotes. The escape >>> single_quoted = 'These allow "double quoting" without "escape" characters.' ->>> double_quoted = "These allow embedded 'single quoting', so you don't have to use an 'escape' character". +>>> double_quoted = "These allow embedded 'single quoting', so you don't have to use an 'escape' character." >>> escapes = 'If needed, a \'slash\' can be used as an escape character within a string when switching quote styles won\'t work.' ``` From 9ba1e59a50b16fddc6b67dee22fe7b0cda827337 Mon Sep 17 00:00:00 2001 From: BethanyG Date: Tue, 24 Feb 2026 16:21:21 -0800 Subject: [PATCH 3/3] Bumped version to ubuntu-24.04 in CI for canonical_sync tests. --- .github/workflows/ci-workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index a065348519f..c2a5519234d 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -48,7 +48,7 @@ jobs: ./bin/template_status.py -v -p .problem-specifications canonical_sync: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 needs: housekeeping strategy: matrix: