[Tutor] How to exit this loop in the interpreter

spawgi at gmail.com spawgi at gmail.com
Thu May 3 15:57:04 CEST 2012

Hello all,

I have encountered the following scenario.
Here is the code - on IDLE on Windows XP.

*>>> while True:
        number = raw_input("enter number - ")
        print number * number
    except ValueError:
        print "invalid number"
        print "unspecified exception"
        print "other conditions"

enter number - 3
unspecified exception
What I noticed is that no matter, what input I give, I cannot exit this
loop. I have tried control-C, control-D etc. all the keys. So how can I
exit from this loop?

Thanks and Regards,

We can do it and do it better.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120503/61de9667/attachment.html>

More information about the Tutor mailing list