Python:
def make_dough(ingredients: list) -> int:
"""
You must always make as much dough as possible regardless of how many pancakes you are going to make.
To make 7dl dough, it takes:
One part egg, 5 parts milk, 4 parts flour, 1 part butter, 2 parts sugar.
PS! It's a random recipe I made up, do not try to pancake according to this.
:param ingredients: given ingredients as a list
:return: dough made in dl
"""
A = [ingredients.count('egg'),
ingredients.count('milk'),
ingredients.count('flour'),
ingredients.count('butter'),
ingredients.count('sugar')]
B = [1, 5, 4, 1, 2]
return 7 * min(a[0] // a[1] for a in zip(A, B))
def can_make_pancake(dough: float) -> bool:
"""
Making one pancake takes 0.8 dl pancake dough.
Return True if you have enough dough to make a pancake, False otherwise.
:param dough: pancake dough given in dl
:return: boolean whether you have enough dough to make a pancake or not
"""
pass
Последнее редактирование модератором: