which a is used?

Jayden jayden.shui at gmail.com
Mon Sep 24 19:43:24 EDT 2012


Dear All,

I have a simple code as follows:

# Begin
a = 1

def f():
    print a

def g():
    a = 20
    f()

g()
#End

I think the results should be 20, but it is 1. Would you please tell me why?

Thanks a lot!




More information about the Python-list mailing list