Skip to content

[Lasagna]: Added docstring and fixed format #2978

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 19 additions & 13 deletions exercises/concept/guidos-gorgeous-lasagna/.meta/exemplar.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
"""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
"""

# time the lasagna should be in the oven according to the cookbook.
EXPECTED_BAKE_TIME = 40
PREPARATION_TIME = 2
Expand All @@ -6,22 +11,22 @@
def bake_time_remaining(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'
: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`.
"""
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`.
"""

return EXPECTED_BAKE_TIME - elapsed_bake_time


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

:param number_of_layers: int the number of lasagna layers made
:return: int amount of prep time (in minutes), based on 2 minutes per layer added
:param number_of_layers: int - the number of lasagna layers made
:return: int - amount of prep time (in minutes), based on 2 minutes per layer added

This function takes an integer representing the number of layers added to the dish,
calculating preparation time using a time of 2 minutes per layer added.
Expand All @@ -33,12 +38,13 @@ def preparation_time_in_minutes(number_of_layers):
def elapsed_time_in_minutes(number_of_layers, elapsed_bake_time):
"""Calculate the elapsed 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 in minutes) preparing and cooking
: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 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.
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.
"""

return preparation_time_in_minutes(number_of_layers) + elapsed_bake_time
9 changes: 7 additions & 2 deletions exercises/concept/guidos-gorgeous-lasagna/lasagna.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
"""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
"""

# TODO: define the 'EXPECTED_BAKE_TIME' constant
# TODO: consider defining the 'PREPARATION_TIME' constant
# equal to the time it takes to prepare a single layer
Expand All @@ -7,8 +12,8 @@
def bake_time_remaining():
"""Calculate the bake time remaining.

:param elapsed_bake_time: int baking time already elapsed.
:return: int remaining bake time derived from 'EXPECTED_BAKE_TIME'.
:param elapsed_bake_time: int - baking time already elapsed.
:return: int - remaining bake time 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
Expand Down