Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from abc import ABC, abstractmethod
- class Factory(ABC):
- def __init__(self, name: str, capacity: int):
- self.name = name
- self.capacity = capacity
- self.ingredients = {}
- @abstractmethod
- def add_ingredient(self, ingredient_type: str, quantity: int):
- pass
- @abstractmethod
- def remove_ingredient(self, ingredient_type: str, quantity: int):
- pass
- def can_add(self, value: int):
- free_slots = self.capacity - sum(self.ingredients.values())
- if free_slots >= value:
- return True
- return False
Advertisement
Add Comment
Please, Sign In to add comment