[Tutor] Help with simple text book example that doesn't work!!!

Brian Drwecki drwecki at gmail.com
Sun Apr 4 07:40:57 CEST 2010

Hi all... I am working from the Learning Python 3rd edition published by
O'Reily... FYI I am trying to learn Python on my own (not for course credit
or anything).. I am a psychologist with very limited programming
experience.. I am anal, and this example code doesn't work.. I am using IDLE
to do everything (ni ni ni ni ni)

So here is the code the book give me..

while True:
    reply = raw_input('Enter text:')
    if reply == 'stop':
    elif not reply.isdigit(  ):
        print 'Bad!' * 8
        print int(reply) ** 2
print 'Bye'

Idle gives me this error  SyntaxError: invalid syntax (it highlights the
word print in the print 'bye' line..

This bugs me!  I don't know why it's not working.. However, I know it is in
the print line... because When I get rid of print it does everything it is
supposed to do..it collects my input and provides feedback..

The print line is supposed to print 'Bye' when you type stop... The book
uses 2.5 I'm using 2.6, but I have no idea what is not working..Any hints?

All help is much appreciated!

Brian D
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100404/42f4cc19/attachment.html>

More information about the Tutor mailing list