class Human(object):
def eat(self, food):
pieces = food.split()
if pieces:
pieces.pop()
return ''.join([piece.replace(piece, "poop ") for piece in
pieces]).strip()
katsuro = Human()
lindsay = Human()
jenny = Human()
human_centipede = [katsuro]
human_centipede.append(lindsay)
human_centipede.append(jenny)
dinner = reduce(lambda food, link: link.eat(food), human_centipede,
"Disgusting bowl of dog food.")
def eat(self, food):
pieces = food.split()
if pieces:
pieces.pop()
return ''.join([piece.replace(piece, "poop ") for piece in
pieces]).strip()
katsuro = Human()
lindsay = Human()
jenny = Human()
human_centipede = [katsuro]
human_centipede.append(lindsay)
human_centipede.append(jenny)
dinner = reduce(lambda food, link: link.eat(food), human_centipede,
"Disgusting bowl of dog food.")