Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Second solution in Clear category for 3 Chefs by thealfest1
class AbstractCook:
def __init__(self):
self.food_total = 0
self.drink_total = 0
def add_food(self, amount, cost):
self.food_total += amount * cost
def add_drink(self, amount, cost):
self.drink_total += amount * cost
def total(self):
total = self.food_total + self.drink_total
return (f'{self.food_name}: {self.food_total}, {self.drink_name}: ' +
f'{self.drink_total}, Total: {total}')
class JapaneseCook(AbstractCook):
food_name, drink_name = 'Sushi', 'Tea'
class RussianCook(AbstractCook):
food_name, drink_name = 'Dumplings', 'Compote'
class ItalianCook(AbstractCook):
food_name, drink_name = 'Pizza', 'Juice'
March 8, 2019