#Phyton / Guido’s Gorgeous Lasagna

1 messages · Page 1 of 1 (latest)

lavish zinc
#

When I try to write the docstrings, it says:

from lasagna import (EXPECTED_BAKE_TIME,
E File ".mnt.exercism-iteration.lasagna.py", line 12
E """Calculate the elapsed cooking time.
E ^
E IndentationError: unindent does not match any outer indentation level

and i copied the docstring that is on task 5.

prisma ridge
#

Can you share your code? Please use a code block!!

lean hazelBOT
lavish zinc
#

to write a code block, i just need to add ``` before and after?

blissful pond
#

yes

lavish zinc
#
EXPECTED_BAKE_TIME = 40
def bake_time_remaining(elapsed_bake_time):
       return EXPECTED_BAKE_TIME - elapsed_bake_time
     """Calculate the baking time remaining.

    :param elapsed_bake_time: int - elapsed cooking time.
    :constant EXPECTED_BAKE_TIME - returns how many minutes the lasagna should bake in the        oven
    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. 
    """

def preparation_time_in_minutes(number_of_layers):
      return number_of_layers * 2
    """Calculate the preparation time in minutes
    :param number_of_layers: int - the number of layers in the lasagna.
    :param elapsed_bake_time: int - elapsed cooking time.
    :return: int - total time elapsed (in minutes) preparing and cooking.
    This function takes two integers representing the number of lasagna layers and the
    time already spent baking and calculates the total elapsed minutes spent cooking the
    lasagna.
    """
def elapsed_time_in_minutes(number_of_layers, elapsed_bake_time):
    return elapsed_bake_time + number_of_layers * 2
     """Calculate the elapsed cooking time.

    :param number_of_layers: int - the number of layers in the lasagna.
    :param elapsed_bake_time: int - elapsed cooking time.
    :return: int - total time elapsed (in minutes) preparing and cooking.

    This function takes two integers representing the number of lasagna layers and the
    time already spent baking and calculates the total elapsed minutes spent cooking the
    lasagna.
    """

blissful pond
#

two things:

  1. docstrings are placed at the beginning of the function, not after it
  2. indentation matters in Python; where you've got
def bake_time_remaining(elapsed_bake_time):
       return EXPECTED_BAKE_TIME - elapsed_bake_time
     """Calculate the baking time remaining.
      ...

you have the second line indented deeper than the third one, which python can't parse