Answers for "what is used of nested function in python"

1

nested functions in python

def print_msg(msg):
    # This is the outer enclosing function

    def printer():
        # This is the nested function
        print(msg)

    return printer  # returns the nested function


# Now let's try calling this function.
# Output: Hello
another = print_msg("Hello")
another()
Posted by: Guest on July-19-2020
-1

what is used of nested function in python

def function1(): # outer function
    print ("Hello from outer function")
    def function2(): # inner function
        print ("Hello from inner function")
    function2()

function1()
Posted by: Guest on March-10-2021

Code answers related to "what is used of nested function in python"

Python Answers by Framework

Browse Popular Code Answers by Language