You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## How this exercise is structured on the Python track
4
4
5
-
The tests for this exercise expect your program to be implemented as a Garden `class` in Python.
6
-
If you are unfamiliar with classes in Python, [classes][classes in python] from the Python docs is a good place to start.
5
+
The tests for this exercise expect your program to be implemented as a Garden [`class`][classes in python] (_see also [concept:python/classes]()_).
6
+
If you are unfamiliar with classes in Python, this [Real Python tutorial][how-to-make-a-class] could be a good additional place to start.
7
+
8
+
Your `class` should implement a [`method`][methods] called `plants`, which takes a student's name as an argument and returns the `list` of plant names belonging to that student.
7
9
8
-
Your `class` should implement a `method` called plants, which takes a student's name as an argument and returns the `list` of plant names belonging to that student.
9
10
10
11
## Constructors
11
12
12
-
Creating the example garden
13
+
Creating the example garden:
13
14
14
-
```
15
+
```python
15
16
[window][window][window]
16
17
VRCGVVRVCGGCCGVRGCVCGCGV
17
18
VRCCCGCRRGVCGCRVVCVGCGCV
18
19
```
19
20
20
21
would, in the tests, be represented as `Garden("VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV")`.
21
22
22
-
To make this representation work, your `class` will need to implement an `__init__()`method.
23
-
If you're not familiar with `__init__()` or _constructors_, [class and instance objects][class vs instance objects in python] from the Python docs gives a more detailed explanation.
23
+
To make this representation work, your `class` will need to implement an [`__init__()`][init][special method][special-methods].
24
+
If you're not familiar with `__init__()` or [_constructors_][what-is-a-constructor], [class and instance objects][class vs instance objects in python] from the Python docs gives a more detailed explanation.
24
25
25
26
26
27
## Default Parameters
@@ -29,6 +30,7 @@ In some tests, a `list` of students is passed as an argument to `__init__()`.
29
30
This should override the twelve student roster provided in the problem statement.
30
31
Both of these statements need to work with your `__init__()` method:
31
32
33
+
32
34
```Python
33
35
# Make a garden based on the default 12-student roster.
One approach is to make the student `list` a [default argument][default argument values]; the Python docs describe `default parameters` in depth while explaining [function definitions][function definitions].
42
43
43
44
44
-
[classes in python]: https://docs.python.org/3/tutorial/classes.html
45
45
[class vs instance objects in python]: https://docs.python.org/3/tutorial/classes.html#class-objects
46
+
[classes in python]: https://docs.python.org/3/tutorial/classes.html#a-first-look-at-classes
In this exercise you're going to create a **class**. _Don't worry, it's not as complicated as you think!_
3
+
## How this exercise is structured on the Python track
4
+
5
+
The tests for this exercise expect you to create a Matrix [`class`][classes] (_see also [concept:python/classes]()_).
6
+
This is different from _using_ a Matrix object from a third-party library such as [Numpy][numpy-matrix], which is not supported.
7
+
_Don't worry, it's not as complicated as you think!_
8
+
For more starting points and details on `classes` and data structures, take a look at the resources below:
9
+
4
10
5
11
-[**A First Look at Classes**](https://docs.python.org/3/tutorial/classes.html#a-first-look-at-classes) from the Python 3 documentation.
6
12
-[**How to Define a Class in Python**](https://realpython.com/python3-object-oriented-programming/#how-to-define-a-class-in-python) from the Real Python website.
7
13
-[**Data Structures in Python**](https://docs.python.org/3/tutorial/datastructures.html) from the Python 3 documentation.
0 commit comments