Reputation: 61
I am beginner to Python, i am trying this follwing code but i cant understand the error
def make(label):
def echo(message):
print(label+':'+message)
make('Message')('Hi')
I expect the output to be Message:Hi
but it showing an error 'NoneType object is not callable
Upvotes: 0
Views: 243
Reputation: 5471
you need to return the echo function
def make(label):
def echo(message):
print(label+':'+message)
return echo
make('Message')('Hi')
Upvotes: 2