PeteCake 字典和最小值
def cakes(recipe, available):
# TODO: insert code
count = []
for item in recipe:
if item not in available:
return 0
else:
count.append(int(available[item]/recipe[item]))
return min(count)
还可以
def cakes(recipe, available): return min(available.get(k, 0)/recipe[k] for k in recipe)