Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
10 changes: 10 additions & 0 deletions concepts/basics/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 3 additions & 5 deletions concepts/bools/about.md
Original file line number Diff line number Diff line change
@@ -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`):

Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions concepts/bools/introduction.md
Original file line number Diff line number Diff line change
@@ -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:

Expand All @@ -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
[bools]: https://docs.python.org/3/library/stdtypes.html#typebool
2 changes: 1 addition & 1 deletion concepts/dicts/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
6 changes: 3 additions & 3 deletions concepts/sets/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ The operator version of this method is `<set> & <other set> & <other set 2> & .

>>> 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']

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

>>> fruit_and_flowers ^ plants_2
{ '🥑', '🌴','🌲', '🌵', '🍈', '🥭'}
>>> fruit_and_flowers ^ set(plants_2)
{'🥭', '🌴', '🌵', '🍈', '🌲', '🥑'}
```

~~~~exercism/note
Expand Down
2 changes: 1 addition & 1 deletion concepts/strings/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -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."
```


Expand Down
2 changes: 1 addition & 1 deletion exercises/concept/black-jack/black_jack.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion exercises/concept/cater-waiter/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ Implement the `check_drinks(<drink_name>, <drink_ingredients>)` 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(<dish_name>, <dish_ingredients>)` function that takes a dish name and a `set` of that dish's ingredients.
The function should return a string with the `dish name: <CATEGORY>` (_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
Expand Down
6 changes: 3 additions & 3 deletions exercises/concept/cater-waiter/.docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ The operator version of this method is `<set> & <other set> & <other set 2> & ..

>>> 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']

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

>>> fruit_and_flowers ^ plants_2
{ '🥑', '🌴','🌲', '🌵', '🍈', '🥭'}
>>> fruit_and_flowers ^ set(plants_2)
{'🥭', '🌴', '🌵', '🍈', '🌲', '🥑'}
```

~~~~exercism/note
Expand Down
16 changes: 10 additions & 6 deletions exercises/concept/ellens-alien-game/classes_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Original file line number Diff line number Diff line change
@@ -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:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
~~~~

<br>
Expand Down Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.'
```
Expand Down
Loading