File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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+
118TSP_PER_TSBP = 3
219TSP_PER_CUP = 48
320
You can’t perform that action at this time.
0 commit comments