today I learn some python.
When I try to write some code, I had some questions.
def outer(a, b):
def inner():
return a+b
return inner
a=outer(4, 3)
print(a)
print(a())
<function outer.<locals>.inner at 0x0000028F37C519D0
7
and this code
def outer2(a, b):
def inner2(c, d):
return c + d
return inner2(a, b)
b = outer2(4,3)
print(b)
print(b())
7
TypeError Traceback (most recent call last) <ipython-input-41-b2c9e3844269> in <module> 5 b = outer2(4,3) 6 print(b) ----> 7 print(b()) TypeError: 'int' object is not callable
I really want to know difference between a and b , anyone can help me? Thank you very much