In my on again, off again studies of Python I am stumped on something that ought to be trivial, but I am not seeing it. When I run this program (only the part up to where the error occurs is shown):
import random numberToGuess = random.randint(1, 20) numberOfGuesses = 0 print("Hello! What is your name?") playerName = input() ...everything works fine from IDLE. However, in the Windows command prompt: E:\Programs\Python\IYOCGwPy\Ch4>python -V Python 3.3.1 E:\Programs\Python\IYOCGwPy\Ch4>guess.py Hello! What is your name? boB Traceback (most recent call last): File "E:\Programs\Python\IYOCGwPy\Ch4\guess.py", line 13, in <module> playerName = input() File "<string>", line 1, in <module> NameError: name 'boB' is not defined E:\Programs\Python\IYOCGwPy\Ch4> This has me totally puzzled. I thought it might have something to do with the fact that I also have Python 2.7 installed, so I removed it from the path variable and also did the check for version that you see above. Okay, the thought occurred to me to put my input in quotes: 'boB' , and I see this works. But why does the command prompt force me to put my strings inside quotes? Perhaps I am too sleepy. It seems I should understand why this is so from some other questions I have asked, but I am not putting it together. Thanks in advance! boB _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor