Create function with parameters
def create_func(name):
def internal():
print(f"Hello {name}")
return internal
foo = create_func("Foo")
foo()
bar = create_func("Bar")
bar()
Hello Foo
Hello Bar
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
def create_func(name):
def internal():
print(f"Hello {name}")
return internal
foo = create_func("Foo")
foo()
bar = create_func("Bar")
bar()
Hello Foo
Hello Bar