Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Първо решение:
- def make_chocolate(self, recipe_name: str):
- if recipe_name not in self.recipes:
- raise TypeError("No such recipe")
- else:
- for ingredient in self.recipes[recipe_name]:
- ingredient_quantity = self.recipes[recipe_name][ingredient]
- self.remove_ingredient(ingredient_type=ingredient, quantity=ingredient_quantity)
- if recipe_name not in self.products:
- self.products[recipe_name] = 0
- self.products[recipe_name] += 1
- Второ решение:
- def make_chocolate(self, recipe_name: str):
- if recipe_name not in self.recipes:
- raise TypeError("No such recipe")
- else:
- for ingredient_type, quantity in self.recipes[recipe_name].items():
- self.remove_ingredient(ingredient_type, quantity)
- self.products[recipe_name] += 1
Advertisement
Add Comment
Please, Sign In to add comment