Define and call a function inside another function : Function Inner « Function « Python






Define and call a function inside another function

Define and call a function inside another function

def f1():
    x = 88
    def f2(x=x):
        print x
    f2()

f1()                  # prints 88

           
       








Related examples in the same category

1.Inner function definitionInner function definition
2.Use lambda to define inner functionUse lambda to define inner function
3.Nested function: 3 levelsNested function: 3 levels