I have this function which returns the wrong result
def calc(a): return lambda op: {
'+': lambda b: calc(a+b),
'-': lambda b: calc(a-b),
'*': lambda b: calc(a*b),
'/': lambda b: calc(a/b),
'=': a}[op]
calc(1)('+')(2)('*')(10)('=') # 30 -> should be 21
Does anyone have an idea how I can keep the functional style and follow the correct mathematical order?