[Tutor] Help with Guess the number script

Scott dunning swdunning at cox.net
Sat Mar 8 19:44:13 CET 2014


> On Mar 8, 2014, at 6:26 AM, Mark Lawrence <breamoreboy at yahoo.co.uk> wrote:
> 
>> On 08/03/2014 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!!
> 
> 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 < 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:-
> 
> if 1 > guess > 100:
> 
OH!  I see what you're saying, ignore my last post.  Yes that looks cleaner.  


More information about the Tutor mailing list