Quick actions

cmd+k|ctrl+k

Navigation

Languages

outer function 2

Snippet info

Language

Python

Visibility

public

Author

aco

Created

2024-10-05T02:11:14.669946Z

Updated

2024-10-05T05:59:57.443413Z

print
def outer():
    x = 'hello'
    def inner():
        x = 'python'
        def inner2():
            nonlocal x
            x = 'monty'
        print('inner1 (before):',x)
        inner2()
        print('inner2 (after):',x)
    inner()
    print('outer:', x)
outer()
INFO