Skip to content

Commit 91fba73

Browse files
authored
Adjusted wording, added links, and fixed formatting. (#4219)
1 parent ba8cffd commit 91fba73

2 files changed

Lines changed: 22 additions & 11 deletions

File tree

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

3-
The tests for this exercise expect your school roster will be implemented via a School `class` in Python.
4-
If you are unfamiliar with classes in Python, [classes][classes in python] from the Python docs is a good place to start.
3+
## How this exercise is structured for the Python track
4+
5+
The tests for this exercise expect your solution to be implemented as a School `class` in Python.
6+
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.
7+
58

69
[classes in python]: https://docs.python.org/3/tutorial/classes.html
Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
# Instructions append
22

3-
## Class-based solution
3+
## How this exercise is structured for the Python track
44

5-
The tests for this exercise expect your solution to be implemented as a `RelativeDistance` class in Python.
6-
Your `RelativeDistance` class should be initialized using `family_tree`, a dictionary where the keys are individuals and the values are lists of that individual's children.
7-
You will also need to implement a `degree_of_separation` method which will return the degree of separation between `person_a` and `person_b` who are individuals in the family tree.
5+
The tests for this exercise expect your solution to be implemented as a RelativeDistance `class` in Python.
6+
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.
87

9-
If you are unfamiliar with classes in Python, here is a brief overview of how to implement the `RelativeDistance` class:
108

11-
A class is a blueprint for creating objects, bundling attributes (data) and methods (functionality) together.
12-
In this exercise, you are given stubbed implementations for the `__init__` special method used to create an instance of the `RelativeDistance` class as well as the `degree_of_separation` method.
13-
To access the `family_tree` data from within the `degree_of_separation` method, you will need to first assign it within the `__init__` method to an appropriate attribute on `self`, which represents the current instance of the `RelativeDistance` class.
9+
`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.
10+
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.
11+
12+
13+
You are given a stubbed implementation for the `__init__` [special method][special-methods] used to create an instance of the `RelativeDistance` class, as well as a stub of the `degree_of_separation` method.
14+
First, you will need to customize the `__init__` with an appropriate attribute on `self` (_the instance_) to represent the `family_tree` data.
1415
Then you can add your logic to the `degree_of_separation` method to calculate the degree of separation between `person_a` and `person_b`.
1516

17+
1618
## Exception messages
1719

1820
Sometimes it is necessary to [raise an exception](https://docs.python.org/3/tutorial/errors.html#raising-exceptions).
@@ -25,4 +27,10 @@ In the first scenario, you will need to raise a `ValueError` when either one or
2527
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.
2628
The tests will only pass if you both `raise` the expected `exception` type and include the expected message with it.
2729

28-
Please check the tests and their expected results carefully.
30+
Please check the tests and their expected results carefully, as these instructions are not exhaustive.
31+
32+
33+
[classes in python]: https://docs.python.org/3/tutorial/classes.html
34+
[init]: https://docs.python.org/3/reference/datamodel.html#object.__init__
35+
[methods]: https://docs.python.org/3/tutorial/classes.html#class-definition-syntax
36+
[special-methods]: https://docs.python.org/3.11/reference/datamodel.html#special-method-names

0 commit comments

Comments
 (0)