Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
7-liner: awkward solution in Creative category for 3 Chefs by przemyslaw.daniel
TEMPLATE_CLASS = """class %sCook:
def __init__(s): s.f = s.d = 0
def add_food(s, a, p): s.f += a*p
def add_drink(s, a, p): s.d += a*p
def total(s): return '%s: '+str(s.f)+', %s: '+str(s.d)+', Total: '+str(s.f+s.d)"""
for c in 'Japanese,Sushi,Tea Russian,Dumplings,Compote Italian,Pizza,Juice'.split():
exec(TEMPLATE_CLASS % tuple(c.split(',')))
June 18, 2018
Comments: