From 45e3d60348759dcd8b201d7f654dae0d0a16e90f Mon Sep 17 00:00:00 2001 From: BethanyG Date: Sun, 21 Jun 2026 21:25:13 -0700 Subject: [PATCH 1/3] Corrected and modified instruction appends per forum post 59962. --- .../grade-school/.docs/instructions.append.md | 3 +-- .../.docs/instructions.append.md | 27 ++++++++++++++----- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/exercises/practice/grade-school/.docs/instructions.append.md b/exercises/practice/grade-school/.docs/instructions.append.md index 5e3425db25..9818c8039b 100644 --- a/exercises/practice/grade-school/.docs/instructions.append.md +++ b/exercises/practice/grade-school/.docs/instructions.append.md @@ -3,7 +3,6 @@ ## How this exercise is structured for the Python track The tests for this exercise expect your solution to be implemented as a School `class` in Python. -If you are unfamiliar with `class`es in Python, [concept:python/classes]() and [classes][classes in python] (_from the Python docs_) are good places to start. - +If you are unfamiliar with `class`es in Python, [concept:python/classes]() and [`classes` in the official Python documentation][classes in python] are good places to start. [classes in python]: https://docs.python.org/3/tutorial/classes.html diff --git a/exercises/practice/relative-distance/.docs/instructions.append.md b/exercises/practice/relative-distance/.docs/instructions.append.md index 37993e781b..976b237dd9 100644 --- a/exercises/practice/relative-distance/.docs/instructions.append.md +++ b/exercises/practice/relative-distance/.docs/instructions.append.md @@ -3,10 +3,10 @@ ## How this exercise is structured for the Python track The tests for this exercise expect your solution to be implemented as a RelativeDistance `class` in Python. -If you are unfamiliar with `class`es in Python, [concept:python/classes]() and [classes][classes in python] (_from the Python docs_) are good places to start. +If you are unfamiliar with `class`es in Python, [concept:python/classes]() and [`classe`s in the official Python documentation][classes in python] are good places to start. -`RelativeDistance` should be initialized (_see [__init__()][init] for more information_)_ using `family_tree`, a dictionary where the `keys` are individuals and `values` are `list`s of that individual's children. +`RelativeDistance` should be initialized (_see [`__init__()`][init] for more information_)_ using `family_tree`, a dictionary where the `keys` are individuals and `values` are `list`s of that individual's children. You will also need to implement a `degree_of_separation` [method][methods] which will return the degree of separation between `person_a` and `person_b` who are individuals in the passed-in family tree. @@ -17,20 +17,33 @@ Then you can add your logic to the `degree_of_separation` method to calculate th ## Exception messages -Sometimes it is necessary to [raise an exception](https://docs.python.org/3/tutorial/errors.html#raising-exceptions). +Sometimes it is necessary to [raise an exception][raising-exceptions]. When you do this, you should always include a **meaningful error message** to indicate what the source of the error is. This makes your code more readable and helps significantly with debugging. -For situations where you know that the error source will be a certain type, you can choose to raise one of the [built in error types](https://docs.python.org/3/library/exceptions.html#base-classes), but should still include a meaningful message. +For situations where you know that the error source will be a certain type, you can choose to raise one of the [built in error types][base-error-classes], but should still include a meaningful message. -This particular exercise requires that you use the [raise statement](https://docs.python.org/3/reference/simple_stmts.html#the-raise-statement) to "throw" multiple `ValueError`s. +This particular exercise requires that you use the [raise statement][raise-statement] to "throw" multiple `ValueError`s. In the first scenario, you will need to raise a `ValueError` when either one or both of the people passed to the `RelativeDistance.degree_of_separation` method are not present in the family tree. + +```python +# Example when Person A is not in the tree. +raise ValueError("Person A not in family tree.") +``` + If both people are present in the family tree, you will need to raise a `ValueError` when there is no valid connection between them as defined by the rules. -The tests will only pass if you both `raise` the expected `exception` type and include the expected message with it. -Please check the tests and their expected results carefully, as these instructions are not exhaustive. +```python +# Example when there are no valid connections. +raise ValueError("No connection between person A and person B.") +``` +The tests will only pass if you both `raise` the expected `exception` type and include the expected message with it. +Please check the tests and their expected results carefully, as these instructions are not exhaustive. +[base-error-classes]: https://docs.python.org/3/library/exceptions.html#base-classes [classes in python]: https://docs.python.org/3/tutorial/classes.html [init]: https://docs.python.org/3/reference/datamodel.html#object.__init__ [methods]: https://docs.python.org/3/tutorial/classes.html#class-definition-syntax +[raising-exceptions]: https://docs.python.org/3/tutorial/errors.html#raising-exceptions +[raise-statement]: https://docs.python.org/3/reference/simple_stmts.html#the-raise-statement [special-methods]: https://docs.python.org/3.11/reference/datamodel.html#special-method-names From 8082ae73d3833fc6f5dfb1654d8cba5ddc5eec7b Mon Sep 17 00:00:00 2001 From: BethanyG Date: Sun, 21 Jun 2026 22:41:33 -0700 Subject: [PATCH 2/3] Update exercises/practice/relative-distance/.docs/instructions.append.md Co-authored-by: Yrahcaz <74512479+Yrahcaz7@users.noreply.github.com> --- .../practice/relative-distance/.docs/instructions.append.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/practice/relative-distance/.docs/instructions.append.md b/exercises/practice/relative-distance/.docs/instructions.append.md index 976b237dd9..b215e7ee33 100644 --- a/exercises/practice/relative-distance/.docs/instructions.append.md +++ b/exercises/practice/relative-distance/.docs/instructions.append.md @@ -6,7 +6,7 @@ The tests for this exercise expect your solution to be implemented as a Relative If you are unfamiliar with `class`es in Python, [concept:python/classes]() and [`classe`s in the official Python documentation][classes in python] are good places to start. -`RelativeDistance` should be initialized (_see [`__init__()`][init] for more information_)_ using `family_tree`, a dictionary where the `keys` are individuals and `values` are `list`s of that individual's children. +`RelativeDistance` should be initialized (_see [`__init__()`][init] for more information_) using `family_tree`, a dictionary where the `keys` are individuals and `values` are `list`s of that individual's children. You will also need to implement a `degree_of_separation` [method][methods] which will return the degree of separation between `person_a` and `person_b` who are individuals in the passed-in family tree. From 3fad63d4aa55e5e7ee66116b7922e1da2056b683 Mon Sep 17 00:00:00 2001 From: BethanyG Date: Sun, 21 Jun 2026 22:41:41 -0700 Subject: [PATCH 3/3] Update exercises/practice/relative-distance/.docs/instructions.append.md Co-authored-by: Yrahcaz <74512479+Yrahcaz7@users.noreply.github.com> --- .../practice/relative-distance/.docs/instructions.append.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/practice/relative-distance/.docs/instructions.append.md b/exercises/practice/relative-distance/.docs/instructions.append.md index b215e7ee33..b90f21a9fe 100644 --- a/exercises/practice/relative-distance/.docs/instructions.append.md +++ b/exercises/practice/relative-distance/.docs/instructions.append.md @@ -3,7 +3,7 @@ ## How this exercise is structured for the Python track The tests for this exercise expect your solution to be implemented as a RelativeDistance `class` in Python. -If you are unfamiliar with `class`es in Python, [concept:python/classes]() and [`classe`s in the official Python documentation][classes in python] are good places to start. +If you are unfamiliar with `class`es in Python, [concept:python/classes]() and [`classes` in the official Python documentation][classes in python] are good places to start. `RelativeDistance` should be initialized (_see [`__init__()`][init] for more information_) using `family_tree`, a dictionary where the `keys` are individuals and `values` are `list`s of that individual's children.