i am new guy.
i ask a easy question.

why the first one have"x",the second one doesn't have "x". what is different? 
when write "x",when don't write "x".

in my point,the second one don't def variable.

(1)

def func(x):
    print 'x is', x
    x = 2
    print 'Changed local x to', x

x = 50
func(x)
print 'x is still', x (2)

def func():
    global x

    print 'x is', x
    x = 2
    print 'Changed local x to', x

x = 50
func()
print 'Value of x is', x 

____________________________________________________________________
DreamMail - 第一次不用是你的错,第二次不用是我的错 www.dreammail.org
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to