Error in lasagna exercise

Is anyone else getting/got this error in the lasagna exercise :) :thinking:


MISSING FUNCTION --> In your '' file, we can not find or import the function named 'preparation_time_in_minutes()'. 
Did you misname or forget to define it?

That error says your code doesn’t define the function preparation_time_in_minutes(). You need to define that function to solve this exercise.

I don’t see that anywhere in the instructions. did I miss it?.

Yes. Third section of the instructions.

def preparation_time_in_minutes(num_of_layers):
    """Calculate the preparation time for lasagna.

    :param num_of_layers: int - the number of layers in the lasagna.
    :return: int - preparation time (in minutes).

    Function that takes the number of layers in the lasagna as an argument
    and returns the preparation time based on a simple logic.
    return num_of_layers * 2

MISSING FUNCTION --> In your '' file, we can not find or import the function named 'elapsed_time_in_minutes()'. 
Did you misname or forget to define it?

This is all I get

That error tells you that you’re missing a function, along with the function name.

  1. Read the error, find what function is missing.
  2. Look at the instructions for that function name to see what it needs to do.
  3. Add that function to your code.


Can someone explain what the last function does? I am confused

The instructions say, “This function should return the total number of minutes you’ve been cooking, or the sum of your preparation time and the time the lasagna has already spent baking in the oven.”

Was there something in particular you would like explained?

I am confused because to me it repeats the previous functions.

There is some overlap for the inputs and output are different. I think this is the only function with multiple inputs. Is there a specific prior function you are confusing this with?

Note, it is pretty common for a module to contain many related functions.

Here is my function but it says the results are different from what is expected. Ie the values are bigger

def elapsed_time_in_minutes(number_of_layers, elapsed_bake_time):
time_cooked = bake_time_remaining(elapsed_bake_time)
prep_time = preparation_time_in_minutes(number_of_layers)
actual_time_cooked = prep_time + time_cooked
return actual_time_cooked

“cooked” and “remaining” sound like very different things to me. Are you sure this line is correct?

1 Like

Thanks ,I figured out my mistake