This lesson covers how to return functions from functions.
The code example in the lesson uses a function called parent()
that contains two inner functions that return a string of text:
def parent(num):
def first_child():
return "Hi, I am Emma"
def second_child():
return "Call me Liam"
if num == 1:
return first_child
else:
return second_child
You’ll see how to access these inner functions and assign them to variables.
Anonymous on March 20, 2019
Nice and clear explainations though the pace for me is a little faster than I would like.