[Tutor] Loop Issue

Yanni Phone yannisphone at gmail.com
Tue Mar 11 14:53:48 CET 2014


Hello all,

I was following along in a book called 'Python Programming for the Absolute
Beginner' by Michael Dawson and I ran into an odd problem with a loop.
Dawson has the following code in his book:

health = 10
trolls = 0
damage = 3

while health != 0:
   trolls += 1
   health -= damage

This seems simple enough. (This is an example of a non-terminating loop, by
the way, so it is not suppose to work correctly.) My problem is that when I
enter this into IDLE, and hot enter a few times. I never get my prompt
(>>>) back. It just lets me hot enter a bunch of time as though it is
expecting more input from me. I tried making a similar loop and it gave me
my prompt back just fine.

Does anyone know what might be going on here?

Thanks,
Yanni
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140311/357dc050/attachment.html>


More information about the Tutor mailing list