88"""
99
1010
11- #TODO (student): define your EXPECTED_BAKE_TIME (required) and PREPARATION_TIME (optional) constants below.
1211
12+ EXPECTED_BAKE_TIME = 40
13+ time_per_layer = 2
1314
14- #TODO (student): Remove 'pass' and complete the 'bake_time_remaining()' function below.
15- def bake_time_remaining ():
15+ def bake_time_remaining (elapsed_bake_time ):
1616 """Calculate the bake time remaining.
1717
1818 Parameters:
@@ -26,19 +26,38 @@ def bake_time_remaining():
2626 based on the `EXPECTED_BAKE_TIME`.
2727 """
2828
29- pass
30-
31-
32- #TODO (student): Define the 'preparation_time_in_minutes()' function below.
33- # To avoid the use of magic numbers (see: https://en.wikipedia.org/wiki/Magic_number_(programming)), you should define a PREPARATION_TIME constant.
34- # You can do that on the line below the 'EXPECTED_BAKE_TIME' constant.
35- # This will make it easier to do calculations, and make changes to your code.
29+ return EXPECTED_BAKE_TIME - elapsed_bake_time
3630
31+ def preparation_time_in_minutes (number_of_layers ):
32+ """Calculate the bake time remaining.
3733
34+ Parameters:
35+ number_of_layers (int): The layers in lasagna.
3836
39- #TODO (student): define the 'elapsed_time_in_minutes()' function below.
37+ Returns:
38+ int: The time (in minutes) needed to prep for lasagna.
4039
40+ Function that takes the number of layers needed for lasagna as
41+ an argument and returns the number of minutes of prep needed per layer of lasagna.
42+ """
43+ result = number_of_layers * time_per_layer
44+ return result
4145
46+ def elapsed_time_in_minutes (number_of_layers , elapsed_bake_time ):
47+ """Calculate the elapsed cooking time.
48+
49+ Parameters:
50+ number_of_layers (int): The number of layers in the lasagna.
51+ elapsed_bake_time (int): Time the lasagna has been baking in the oven.
52+
53+ Returns:
54+ int: The total time elapsed (in minutes) preparing and baking.
4255
43- # TODO (student): Remember to go back and add docstrings to all your functions
44- # (you can copy and then alter the one from bake_time_remaining.)
56+ This function takes two integers representing the number of lasagna
57+ layers and the time already spent baking the lasagna. It calculates
58+ the total elapsed minutes spent cooking (preparing + baking).
59+
60+ """
61+ prep_time = preparation_time_in_minutes (number_of_layers )
62+ total_time = elapsed_bake_time + prep_time
63+ return total_time
0 commit comments