Title: Signature.html
Ah, the +1 is to add clarity to the program. updown is either 1, or -1, or, better in this case, as +1 or -1. It's quite possible the code will be read by others eventually. I'm emphasizing the purpose of the variable by reminding the reader of its significance. Plus is associated with moving forward along a line, and negative in the order direction.

I suppose this is similar to something I did long ago for a program that I called p, just one letter. A colleague who was working with me asked why I did that. It takes one key stroke to execute it was my answer. When it got out of development, I gave it a more fitting name. It also kept it easily visible from other programs and files in my folder when I was looking for it. I suspect I really called it a.

Yes, variations on !=, <>, not equal, .ne., ... Just a hold over from former languages.

Alan Gauld wrote:

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,



--
           Wayne Watson (Watson Adventures, Prop., Nevada City, CA)

             (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
              Obz Site:  39° 15' 7" N, 121° 2' 32" W, 2700 feet
            
            "Though no one can go back and make a brand new start, 
	     ANYONE can start from now and make a brand new end." 
		                    -- Anonymous
            
                    Web Page: <www.speckledwithstars.net/>
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to