[Tutor] Help with Guess the number script

spir denis.spir at gmail.com
Sat Mar 8 11:57:25 CET 2014


On 03/08/2014 10:13 AM, Alan Gauld wrote:
> On 08/03/14 01:23, Scott W Dunning wrote:
>>
>> On Mar 7, 2014, at 11:02 AM, Alan Gauld <alan.gauld at btinternet.com> wrote:
>>
>> GOT IT!!  Finally!  Thanks for all of your help!!
>>
>> This is what I got, not sure if it’s correct but it’s working!
>
> Well done.
> And now that you have the right set of tests you can
> half the number of lines by combining your if
> conditions again, like you had in the original
> post. ie. Bring your hot/cold/warm tests together.

Yes, and note the relevant piece of data is the absolute value: 
abs(secret-guess). This gives you at once on-fire / hot / warm / cold / icy ... 
whatever you like ;-) (pretty sexy game, guess-my-number!).

d


More information about the Tutor mailing list