Skip to content

Commit 50d603a

Browse files
authored
Update and rename recipe to recipe.py
1 parent 7d0d885 commit 50d603a

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

recipe renamed to recipe.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
print("""
2+
Many recipe books still use cups, tablespoons and teaspoons to describe the volumes of ingredients used
3+
when cooking or baking. While such recipes are easy enough to follow if you have the appropriate
4+
measuring cups and spoons, they can be difficult to double, triple or quadruple when cooking Christmas
5+
dinner for the entire extended family. For example, a recipe that calls for 4 tablespoons of an ingredient
6+
requires 16 tablespoons when quadrupled. However, 16 tablespoons would be better expressed (and
7+
easier to measure) as 1 cup.
8+
Write a function that expresses an imperial volume using the largest units possible. The function will take
9+
the number of units as its first parameter, and the unit of measure (cup, tablespoon or teaspoon) as its
10+
second parameter. Return a string representing the measure using the largest possible units as the
11+
function’s only result.
12+
For example, if the function is provided with parameters representing 59 teaspoons then it should return
13+
the string “1 cup, 3 tablespoons, 2 teaspoons”.
14+
Hint: One cup is equivalent to 16 tablespoons. One tablespoon is equivalent to 3 teaspoons.
15+
Name your file as recipe.py. """)
16+
17+
118
TSP_PER_TSBP = 3
219
TSP_PER_CUP =48
320

0 commit comments

Comments
 (0)