[Tutor] Tutor Digest, Vol 25, Issue 54
Kent Johnson
kent37 at tds.net
Wed Mar 22 11:57:33 CET 2006
Keo Sophon wrote:
> Anyway, how can i declare a global variable and assign a value to it in a
> function?
The usual way to do this is to return a value from the function and
assign it to the variable. For example:
def double(x):
return x*2
x=2
doublex = double(x)
You really should look at one of the beginners tutorials listed here,
they will answer many of your questions:
http://wiki.python.org/moin/BeginnersGuide/NonProgrammers
Kent
More information about the Tutor
mailing list