You're going to write some code to help you cook a gorgeous lasagna from your favorite cookbook.
You have five tasks, all related to cooking your recipe.
<br>We have started the first function definition for you in the stub file, but you will need to write the remaining function definitions yourself. You will also need to define any constants yourself. Read the #TODO comment lines in the stub file carefully. Once you are done with a task, remove the TODO comment.
Define the EXPECTED_BAKE_TIME constant that represents how many minutes the lasagna should bake in the oven.
According to your cookbook, the Lasagna should be in the oven for 40 minutes:
>>> print(EXPECTED_BAKE_TIME)
40Complete the bake_time_remaining() function that takes the actual minutes the lasagna has been in the oven as an argument and returns how many minutes the lasagna still needs to bake based on the EXPECTED_BAKE_TIME constant.
>>> bake_time_remaining(30)
10Define the preparation_time_in_minutes() function that takes the number_of_layers you want to add to the lasagna as an argument and returns how many minutes you would spend making them.
Assume each layer takes 2 minutes to prepare.
>>> def preparation_time_in_minutes(number_of_layers):
...
...
>>> preparation_time_in_minutes(2)
4Define the elapsed_time_in_minutes() function that takes two parameters as arguments:
number_of_layers (the number of layers added to the lasagna)elapsed_bake_time (the number of minutes the lasagna has spent baking in the oven already).This function should return the total minutes you have been in the kitchen cooking — your preparation time layering + the time the lasagna has spent baking in the oven.
>>> def elapsed_time_in_minutes(number_of_layers, elapsed_bake_time):
...
...
>>> elapsed_time_in_minutes(3, 20)
26Go back through the recipe, adding "notes" in the form of function docstrings.
def elapsed_time_in_minutes(number_of_layers, elapsed_bake_time):
"""Calculate the elapsed cooking time.
Parameters:
number_of_layers (int): The number of layers in the lasagna.
elapsed_bake_time (int): Time the lasagna has been baking in the oven.
Returns:
int: The total time elapsed (in minutes) preparing and baking.
This function takes two integers representing the number of lasagna
layers and the time already spent baking the lasagna. It calculates
the total elapsed minutes spent cooking (preparing + baking).
"""You're going to write some code to help you cook a gorgeous lasagna from your favorite cookbook.
You have five tasks, all related to cooking your recipe.
<br>We have started the first function definition for you in the stub file, but you will need to write the remaining function definitions yourself. You will also need to define any constants yourself. Read the #TODO comment lines in the stub file carefully. Once you are done with a task, remove the TODO comment.
Define the EXPECTED_BAKE_TIME constant that represents how many minutes the lasagna should bake in the oven.
According to your cookbook, the Lasagna should be in the oven for 40 minutes:
>>> print(EXPECTED_BAKE_TIME)
40Complete the bake_time_remaining() function that takes the actual minutes the lasagna has been in the oven as an argument and returns how many minutes the lasagna still needs to bake based on the EXPECTED_BAKE_TIME constant.
>>> bake_time_remaining(30)
10Define the preparation_time_in_minutes() function that takes the number_of_layers you want to add to the lasagna as an argument and returns how many minutes you would spend making them.
Assume each layer takes 2 minutes to prepare.
>>> def preparation_time_in_minutes(number_of_layers):
...
...
>>> preparation_time_in_minutes(2)
4Define the elapsed_time_in_minutes() function that takes two parameters as arguments:
number_of_layers (the number of layers added to the lasagna)elapsed_bake_time (the number of minutes the lasagna has spent baking in the oven already).This function should return the total minutes you have been in the kitchen cooking — your preparation time layering + the time the lasagna has spent baking in the oven.
>>> def elapsed_time_in_minutes(number_of_layers, elapsed_bake_time):
...
...
>>> elapsed_time_in_minutes(3, 20)
26Go back through the recipe, adding "notes" in the form of function docstrings.
def elapsed_time_in_minutes(number_of_layers, elapsed_bake_time):
"""Calculate the elapsed cooking time.
Parameters:
number_of_layers (int): The number of layers in the lasagna.
elapsed_bake_time (int): Time the lasagna has been baking in the oven.
Returns:
int: The total time elapsed (in minutes) preparing and baking.
This function takes two integers representing the number of lasagna
layers and the time already spent baking the lasagna. It calculates
the total elapsed minutes spent cooking (preparing + baking).
"""