[Tutor] Loop Issue

spir denis.spir at gmail.com
Fri Mar 14 11:22:46 CET 2014


On 03/13/2014 04:42 PM, Dave Angel wrote:
>   spir <denis.spir at gmail.com> Wrote in message:
>> On 03/13/2014 12:40 AM, Danny Yoo wrote:
>>> The context is the beginning of the thread:
>>>
>>>       https://mail.python.org/pipermail/tutor/2014-March/100543.html
>>>
>>> with the loop:
>>>
>>>
>>> ###
>>> while health != 0:
>>>       ...
>>> ###
>>
>> The point, and reason why this loop was (potentially) infinite, is that the
>> condition was false. Should be <0 instead ('cause health points are not removed
>> one by one, so that a health value of 0 exactly can be jumped over).
>>
>
> Well unless I misremember,  the value of health goes down.  So
>   you'd want
>
>      while health > 0

oops!
and "the condition was false" --> "wrong"

d



More information about the Tutor mailing list