Skip to content

Commit be7378d

Browse files
authored
Changed wording of task 4 and added notes about magic numbers in stub file and hint file. (#3930)
1 parent 5b8462a commit be7378d

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

exercises/concept/guidos-gorgeous-lasagna/.docs/hints.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424

2525
- You need to define a [function][defining functions] with a single parameter representing the number of layers.
2626
- Use the [mathematical operator for multiplication][numbers] to multiply values.
27-
- You could define an extra _constant_ for the time in minutes per layer rather than using a "magic number" in your code.
27+
- You can define a PREPARATION_TIME _constant_ for the time in minutes per layer rather than using a ["magic
28+
number"][magic-numbers] in your code.
2829
- This function should [return a value][return].
2930

3031
## 4. Calculate total elapsed cooking time (prep + bake) in minutes
@@ -43,6 +44,7 @@
4344
[constants]: https://stackoverflow.com/a/2682752
4445
[defining functions]: https://docs.python.org/3/tutorial/controlflow.html#defining-functions
4546
[docstrings]: https://docs.python.org/3/tutorial/controlflow.html#tut-docstrings
47+
[magic-numbers]: https://en.wikipedia.org/wiki/Magic_number_(programming)
4648
[naming]: https://realpython.com/python-variables/
4749
[numbers]: https://docs.python.org/3/tutorial/introduction.html#numbers
4850
[pep257]: https://www.python.org/dev/peps/pep-0257/

exercises/concept/guidos-gorgeous-lasagna/.docs/instructions.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,16 @@ Assume each layer takes 2 minutes to prepare.
5050
```
5151

5252

53-
## 4. Calculate total elapsed cooking time (prep + bake) in minutes
53+
## 4. Calculate total elapsed time (prepping + baking) in minutes
54+
55+
Define the `elapsed_time_in_minutes()` function that takes two parameters as arguments:
56+
57+
- `number_of_layers` (_the number of layers added to the lasagna_)
58+
- `elapsed_bake_time` (_the number of minutes the lasagna has spent baking in the oven already_).
59+
60+
This function should return the total minutes you have been in the kitchen cooking — your preparation time layering +
61+
the time the lasagna has spent baking in the oven.
5462

55-
Define the `elapsed_time_in_minutes()` function that takes two parameters as arguments: `number_of_layers` (_the number of layers added to the lasagna_) and `elapsed_bake_time` (_the number of minutes the lasagna has been baking in the oven_).
56-
This function should return the total number of minutes you have been cooking, or the sum of your preparation time and the time the lasagna has already spent baking in the oven.
5763

5864
```python
5965
>>> def elapsed_time_in_minutes(number_of_layers, elapsed_bake_time):

exercises/concept/guidos-gorgeous-lasagna/lasagna.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"""
99

1010

11-
#TODO: define the 'EXPECTED_BAKE_TIME' constant below.
11+
#TODO: define your EXPECTED_BAKE_TIME (required) and PREPARATION_TIME (optional) constants below.
1212

1313

1414
#TODO: Remove 'pass' and complete the 'bake_time_remaining()' function below.
@@ -27,9 +27,9 @@ def bake_time_remaining():
2727

2828

2929
#TODO: Define the 'preparation_time_in_minutes()' function below.
30-
# You might also consider defining a 'PREPARATION_TIME' constant.
30+
# To avoid the use of magic numbers (see: https://en.wikipedia.org/wiki/Magic_number_(programming)), you should define a PREPARATION_TIME constant.
3131
# You can do that on the line below the 'EXPECTED_BAKE_TIME' constant.
32-
# This will make it easier to do calculations.
32+
# This will make it easier to do calculations, and make changes to your code.
3333

3434

3535

0 commit comments

Comments
 (0)