"Peter Otten" <[email protected]> wrote

x = input("a, b, or c:")
...

If she were using 2.x and typed an 'a' she would get a NameError.

Oops, too early in the morning.
For some reason I thought she was using numbers... Doh!


If you want your code to work in both Python
versions you could explicitly convert the input()
result to a string:

 x = str(input("a, b, or c:"))

str() doesn't magically uneval.

Nope, again it would only work with numbers!

Sorry folks, I'll drink a coffee before answering posts in future! :-)

--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/


_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to