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

updown = +1

Is this meant to be

updown += 1

maybe?

Although as the error message shows you need to set it to a
valid value before incrementing it, so mayber you just meant

updown = 1  # no need for the + sign

while keyop <> 0:

And the <> form of not equal is deprecated in favour of != so
this should probably be

while keyop != 0

Or better still just

while keyop:

You forgot to create keyop in this example.
UnboundLocalError: local variable 'updown' referenced before assignment

HTH,


--
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to