On 03/12/2014 05:13 AM, Scott Dunning wrote:
>>     if guess < secret - 10 or guess > secret - 10:
>
>This is the right idea for cutting the line count but you
>have the comparison values wrong. Look back to earlier
>emails, you are repeating the same error as before.
>Manually think through what happens in the line above
>if guess == secret.
Oh, do you mean it should be <= and >=??  I’m not sure why that would work, 
because if guess==secret I have another statement in my code that takes care of that. 
 I didn’t want to add my whole code because it’s too long but that is in there.

Such errors are either obvious or invisible. A remedy is often to figure the problem on paper (or in your head if you're good at thinking visually). Here, just draw a line segment with secret in the middle and the interval borders around. Then, write there on the drawing the _values_ of the borders, as arithmetic expressions.

d
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to