-
Notifications
You must be signed in to change notification settings - Fork 0
/
lasagna.py
44 lines (31 loc) · 1.51 KB
/
lasagna.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
"""lasagna.py"""
EXPECTED_BAKE_TIME = 40
PREPARATION_TIME = 2
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 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`.
"""
return EXPECTED_BAKE_TIME - elapsed_bake_time
def preparation_time_in_minutes(number_of_layers):
"""Calculate preparation time in minutes
:param number_of_layers: int number of layers
:return: int number of minutes
Implement the `preparation_time_in_minutes()` function that takes the number
of layers you want to add to the lasagna as an argument and returns how many
minutes you would spend making them. Assume each layer takes 2 minutes to prepare.
"""
return number_of_layers * PREPARATION_TIME
def elapsed_time_in_minutes(number_of_layers, elapsed_bake_time):
"""
Return elapsed cooking time.
:param number_of_layers: int number of layers
:param elapsed_bake_time: int baking time already elapsed.
:return: int number of minutes
This function takes two numbers representing the number of layers & 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