Quick actions

cmd+k|ctrl+k

Navigation

Languages

Scoping 4

Snippet info

Language

Python

Visibility

public

Author

petersnpan2047

Created

2026-05-04T04:36:46.249166Z

Updated

2026-05-04T04:36:46.249166Z

def a():
    x = 1
    y = 2  
    def b():
        global y      # this y is for all, not y = 2 above
        y = 1         # set global y to be 1
        print(y,x)
    b()
    print(y)
a()
print(y)
INFO