Python / Guido's Gorgeous Lasagna on Exercism

I tackled 4 problems on this but cannot pass on task 5. Here is my code

“”"Functions used in preparing Guido’s gorgeous lasagna.

This is a module docstring, used to describe the functionality
of a module and its functions and/or classes…
“”"

#TODO: define the ‘EXPECTED_BAKE_TIME’ constant.
EXPECTED_BAKE_TIME = 40

#TODO: Remove ‘pass’ and complete the ‘bake_time_remaining()’ function below.
def bake_time_remaining(elapsed_bake_time):
return max(0, EXPECTED_BAKE_TIME - elapsed_bake_time)

``````"""Calculate the bake time remaining.

:param elapsed_bake_time: int - baking time already elapsed.
:return: int - remaining bake time (in minutes) derived from 'EXPECTED_BAKE_TIME'.

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`..
"""
``````

#TODO: Define the ‘preparation_time_in_minutes()’ function below.

You might also consider using ‘PREPARATION_TIME’ here, if you have it defined…

MINUTES_PER_LAYERS = 2
def preparation_time_in_minutes(number_of_layers):
“”"
Calculate the preparation time in minutes.

``````:param number_of_layers: int - the number of layers in the lasagna.
:return: int - total preparation time (in minutes) based on the number of layers.

This function takes an integer representing the number of lasagna layers and
calculates the total preparation time in minutes..
"""
return number_of_layers * MINUTES_PER_LAYERS
``````

#TODO: define the ‘elapsed_time_in_minutes()’ function below.

Remember to add a docstring (you can copy and then alter the one from bake_time_remaining…)

def elapsed_time_in_minutes(number_of_layers, elapsed_bake_time):
“”"Calculate elapsed cooking time.
:param number_of_layers: the number of layers in the lasagna.
:param elapsed_bake_time: elapsed cooking time.
:return: total time elapsed (in minutes) preparing and cooking…

``````"""
prep_time = preparation_time_in_minutes(number_of_layers)
return prep_time + elapsed_bake_time
``````

Please first read the pinned thread in order to understand how to post the code properly; then clearly explain what issue you are encountering or what you want us to tell you. Right now, we can’t see the assignment, or what “task 5” means.

When you try using the code, exactly what do you expect to happen, step by step?

According to your testing, what appears to be happening instead; and how is that different?

Also: instead of deleting and reposting threads to try to fix something, please edit your post by clicking the pencil icon at the bottom.

2 Likes