Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for 3 Chefs by mozurin
class AbstractCook:
def __init__(self):
self.food = self.drink = 0
def add_food(self, amount, price):
self.food += amount * price
def add_drink(self, amount, price):
self.drink += amount * price
def total(self):
return (
f'{self.FOOD}: {self.food}, {self.DRINK}: {self.drink}, '
f'Total: {self.food + self.drink}'
)
class JapaneseCook(AbstractCook):
FOOD = 'Sushi'
DRINK = 'Tea'
class RussianCook(AbstractCook):
FOOD = 'Dumplings'
DRINK = 'Compote'
class ItalianCook(AbstractCook):
FOOD = 'Pizza'
DRINK = 'Juice'
July 6, 2018