On 12/25/2011 09:46 PM, Joel Goldstick wrote:
You can either move the stuff at the top of your program into main, or
you could pass the outer new
into main as a parameter: main(new):
the third alternative is to use the global keyword, e.g.
# declare a global named 'new'
new = 0
def increment_new():
# tell python to use the global 'new' instead of
# creating a local 'new'
global new
new += 1
print new
increment_new()
print new
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor