[Tutor] Local Unbound Mystery

Sander Sweers sander.sweers at gmail.com
Sat Sep 20 12:30:12 CEST 2008


On Sat, Sep 20, 2008 at 00:23, Wayne Watson
<sierra_mtnview at sbcglobal.net> wrote:
> Well, it made a difference, and now program and output are in agreement.

Not really the code has an error so it could not have worked.

> updown = +1
> while keyop <> 0:

You forgot to create keyop in this example.

> UnboundLocalError: local variable 'updown' referenced before assignment
> ...
> http://effbot.org/pyfaq/how-do-you-set-a-global-variable-in-a-function.htm

Did you actually read the link Kent provided? It does not look like you did.

Greets
Sander


More information about the Tutor mailing list