Re: [Tutor] Help with Guess the number script

2014-03-08 Thread eryksun
On Sat, Mar 8, 2014 at 1:44 PM, Scott dunning wrote: >> if 1 > guess > 100: >> > OH! I see what you're saying, ignore my last post. Yes that looks > cleaner. Please read section 6.9 of the language reference, which defines Python comparison expressions. http://docs.python.org/3/reference/expre

Re: [Tutor] Help with Guess the number script

2014-03-08 Thread Scott dunning
> On Mar 8, 2014, at 3:57 AM, spir wrote: > >> 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 wrote: >>> >>> GOT IT!! Finally! Thanks for all of your help!! >>> >>> This is what I got, not sure if it’s

Re: [Tutor] Help with Guess the number script

2014-03-08 Thread Scott dunning
> On Mar 8, 2014, at 6:26 AM, Mark Lawrence wrote: > >> On 08/03/2014 01:23, Scott W Dunning wrote: >> >> On Mar 7, 2014, at 11:02 AM, Alan Gauld wrote: >> >> GOT IT!! Finally! Thanks for all of your help!! > > If at first you don't succeed... :) > >> >> This is what I got, not sure if i

Re: [Tutor] Help with Guess the number script

2014-03-08 Thread Scott dunning
> On Mar 8, 2014, at 6:36 AM, Dave Angel wrote: > > Mark Lawrence Wrote in message: >>> On 08/03/2014 01:23, Scott W Dunning wrote: >>> >>> >>> def print_hints(secret, guess): >>> if guess < 1 or guess > 100: >> >> Only now do I feel that it's time to point out that the above line would

Re: [Tutor] Help with Guess the number script

2014-03-08 Thread Mark Lawrence
On 08/03/2014 14:29, eryksun wrote: Anyway, you needn't go out of your way to rewrite the expression using a chained comparison. The disjunctive expression is actually implemented more efficiently by CPython's compiler, which you can verify using the dis module to disassemble the bytecode. I h

Re: [Tutor] Help with Guess the number script

2014-03-08 Thread eryksun
On Sat, Mar 8, 2014 at 8:36 AM, Dave Angel wrote: > Mark Lawrence Wrote in message: >> On 08/03/2014 01:23, Scott W Dunning wrote: >> >>> def print_hints(secret, guess): >>> if guess < 1 or guess > 100: >> >> Only now do I feel that it's time to point out that the above line would >> probab

Re: [Tutor] Help with Guess the number script

2014-03-08 Thread Dave Angel
Mark Lawrence Wrote in message: > On 08/03/2014 01:23, Scott W Dunning wrote: > >> >> def print_hints(secret, guess): >> if guess < 1 or guess > 100: > > Only now do I feel that it's time to point out that the above line would > probably be written by an experienced Python programmer as:-

Re: [Tutor] Help with Guess the number script

2014-03-08 Thread Mark Lawrence
On 08/03/2014 01:23, Scott W Dunning wrote: On Mar 7, 2014, at 11:02 AM, Alan Gauld wrote: GOT IT!! Finally! Thanks for all of your help!! If at first you don't succeed... :) This is what I got, not sure if it’s correct but it’s working! def print_hints(secret, guess): if guess <

Re: [Tutor] Help with Guess the number script

2014-03-08 Thread spir
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 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

Re: [Tutor] Help with Guess the number script

2014-03-08 Thread Alan Gauld
On 08/03/14 01:23, Scott W Dunning wrote: On Mar 7, 2014, at 11:02 AM, Alan Gauld 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

Re: [Tutor] Help with Guess the number script

2014-03-08 Thread Scott W Dunning
On Mar 7, 2014, at 11:02 AM, Alan Gauld 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! def print_hints(secret, guess): if guess < 1 or guess > 100: print print "Out of range!" print if gues