This is my first question in stack overflow! sorry for my bad English :)
I'm newbie in python and something weird happened to me when I was tried to define a function, that returning other functions. Here is my first code:
def hello_function():
def say_hi():
return "Hi"
return say_hi
print(hello_function())
The output is: <function hello_function.<locals>.say_hi at 0x000001F9B2C3CE50>
but when i Assigned hello_function() to hello variable and call the hello(), the output is correct:
def hello_function():
def say_hi():
return "Hi"
return say_hi
hello = hello_function()
hello()
output: 'Hi'