I am struggling with the Lasagna exercise

As I was thinking about the “problem” and looking at all those Lasagna problems, not only I got hungry, but I had a few more ideas which I wanted to put out there (here?)

@SleeplessByte listed above a number of concerns that might be important moving between languages. There is a finite (although growing) number of concepts in programming. Programming languages effectively pick and mix more than innovate. And so, it should be possible to come out with a list of characteristics and concepts with brief description, perhaps with a series of links to good resources, explainers.

With that a few things could be possible.

  1. Generate personalised pages explaining moves between languages. The user could indicate (or we could know from what they have done on Exercism) what langauges they already know and they could be shown concisely the differences in the target language. Typing, block identification, comments, mutability. Things like that.

  2. At the top of exercises, and intro to intro sort of thing, we could have a list of concepts necessary to complete the exercise. A bullet point list to the explanations in general, and specifically in the language. Advantage of this would be that the introduction would be shorter for those who don’t need too much hand-holding, or who just want to give it a go. At the same time the general concepts could be shared between languages and so there would be less text to write over all. It would also allow better user experience if they don’t follow the exact path intended by the track designer.

  3. The above could be improved by tracking what concepts the users already tried not only in this but also in other languages and indicate that to them. Those covered could be either hidden from the list - the list could be renamed to ‘concepts you will learn’. Or the full list could be shown to indicate how much they already know.

  4. Concepts… the name is already used for groupings of tasks. I’m struggling with to find a word that would mean individual building blocks of programming. Things like variable, constant, assignment, operator, prefix notation, infix notation, class, function, invocation, binding… and so on.

Wouldn’t it be good addition to the gamification of user experience to somehow track and show users what they already know across languages and how easily they can move from one to another?

I know the above might be a lot of work and not something important at the current stage of Exercism development… but here they are for you to ignore :smiley:

1 Like

Hi there, I seem to be having a problem passing the test for task 5 as I seem to keep getting an error. Is there a problem with my code below?

"""Functions used in preparing Guido's gorgeous lasagna.

Learn about Guido, the creator of the Python language:
https://en.wikipedia.org/wiki/Guido_van_Rossum

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.
import lasagna
lasagna.EXPECTED_BAKE_TIME = 40

#TODO: Remove 'pass' and complete the 'bake_time_remaining()' function below.
def bake_time_remaining(remaining_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`.
    """
    bake_time_remaining = lasagna.EXPECTED_BAKE_TIME - remaining_time
    return bake_time_remaining

#TODO: Define the 'preparation_time_in_minutes()' function below.
# You might also consider using 'PREPARATION_TIME' here, if you have it defined.
def preparation_time_in_minutes(number_of_layers):
    preparation_time_in_minutes = number_of_layers * 2
    return preparation_time_in_minutes


#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):
    """Return the elapsed cooking time. 
    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. 
    """
    elapsed_time_in_minutes = (number_of_layers*2) + elapsed_bake_time
    return elapsed_time_in_minutes


What error are you getting?

The error message that I seem to be getting is that one of the variations of the test had failed. It expected a docstring but mentioned that it received none instead. Did I fail to classify the docstring?

Your preparation_time_in_minutes function is missing a docstring. Try adding:

"""Calculate the preparation time.""" 

Indented, just below the function definition, like this:

def preparation_time_in_minutes(number_of_layers):
    """Calculate the preparation time."""        

Ah I see. Can’t believe I missed out on that. Thank you!

1 Like

2 posts were split to a new topic: Stuggling to understand what the code means in Lasagna