def python nested code example
Example 1: python nested function
var = 0
name = 'absicsa'
def function_outer():
name = 'nabisco'
def function_inner():
global var
name = 'outlet'
var = 23
print('name :',name, ', var :', var)
print('name :', name, ', var :', var)
function_inner()
print('name :', name, ', var :', var)
function_outer()
Example 2: what is used of nested function in python
def function1():
print ("Hello from outer function")
def function2():
print ("Hello from inner function")
function2()
function1()