[Tutor] Runs in IDLE with F5, but not in Windows Command Prompt

Marc Tompkins marc.tompkins at gmail.com
Thu Apr 25 15:45:09 CEST 2013


On Thu, Apr 25, 2013 at 5:40 AM, boB Stepp <robertvstepp at gmail.com> wrote:

> One thing that no one has addressed so far is why when I put quotes
> around my input, as in 'boB', the program does run in the command
> prompt.
>

Remember that input(), in Python 2, executes what's passed to it.  If your
input is boB, then Python tries to execute the statement boB - and unless
you've previously defined boB, Python doesn't know what to do with it.

If you put quotes around your input, Python recognizes it as a string
literal.  Python "executes" string literals by simply printing them to
standard output - try it at a Python prompt sometime - which is probably
not the behavior you were expecting, but doesn't throw an error either.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130425/aee3701a/attachment.html>


More information about the Tutor mailing list