On Mar 11, 2014, at 1:57 AM, Alan Gauld <alan.ga...@btinternet.com> wrote: > OK so far, you don't need all the print statements > but that's just a style issue. (You could just > insert '\n' characters instead.) You’re right, I’m actually not sure why I did it that way.
> >> 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. > > And then once you get that fixed you can rewrite using > the chained comparison trick to tidy it up. > ie > if not (lower limit < guess > upper limit): I see what you’re saying about the chained comparison. What I’m having problems with is condensing it to half the lines of code so I don’t have to have the same conditionals under both ‘too low’ and ‘to high’. If that makes sense. > > _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor