bill.wu [EMAIL PROTECTED] wrote
i ask a easy question.
why the first one havex,the second one
doesn't have x. what is different?
The first is using x as the name of a parameter
of the function and is only used inside the function.
The second one takes no parameter and relies on
bill.wu wrote:
i am new guy.
i ask a easy question.
There is no need to ask twice.
Please post messages in plain-text, not HTML.
Kent
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
i am new guy.
i ask a easy question.
why the first one havex,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)
bill.wu bill.wws at gmail.com writes:
i am new guy.
i ask a easy question.
why the first one havex,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.
Variable scope. By declaring the x as