Re: [Tutor] Help with Guess the number script

2014-03-10 Thread Dave Angel
Scott W Dunning Wrote in message: > Would you please stop posting in html? > def print_hints(secret, guess):     if guess < 1 or guess > 100:         print         print "Out of range!"         print     if guess < secret:         print         print "Too low!"     i

Re: [Tutor] Help with Guess the number script

2014-03-10 Thread Scott W Dunning
On Mar 8, 2014, at 11:50 AM, Scott dunning wrote: >>> >>> 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. I’m having a hard time doing

Re: [Tutor] Python implementations

2014-03-10 Thread Ben Finney
Scott W Dunning writes: > On Mar 10, 2014, at 8:52 PM, Ben Finney wrote: > > > > What does the Python interactive prompt display when you first launch an > > interactive Python shell? > > Python 2.7.6 (v2.7.6:3a1db0d2747e, Nov 10 2013, 00:42:54) > [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on

Re: [Tutor] Python implementations (was: Help with Guess the number script)

2014-03-10 Thread Scott W Dunning
On Mar 10, 2014, at 8:52 PM, Ben Finney wrote: > > What does the Python interactive prompt display when you first launch an > interactive Python shell? Python 2.7.6 (v2.7.6:3a1db0d2747e, Nov 10 2013, 00:42:54) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type "copyright", "credits" or

Re: [Tutor] Python implementations (was: Help with Guess the number script)

2014-03-10 Thread Scott W Dunning
On Mar 10, 2014, at 8:52 PM, Ben Finney wrote: > > What does the Python interactive prompt display when you first launch an > interactive Python shell? Python 2.7.6 (v2.7.6:3a1db0d2747e, Nov 10 2013, 00:42:54) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type "copyright", "credits" or

Re: [Tutor] Help with Guess the number script

2014-03-10 Thread Scott W Dunning
>> On Mar 8, 2014, at 3:57 AM, spir wrote: >>> >>> 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. So below is what I fi

[Tutor] Python implementations (was: Help with Guess the number script)

2014-03-10 Thread Ben Finney
Scott W Dunning writes: > What exactly is Cpython? Python is a language, with numerous implementations. CPython is one of those implementations. See https://wiki.python.org/moin/PythonImplementations> for an overview. > Is it different from the python I’m using? I don't know; how did you acqu

Re: [Tutor] Help with Guess the number script

2014-03-10 Thread Scott W Dunning
On Mar 10, 2014, at 4:15 AM, eryksun wrote: > > Different strokes for different folks. I like to tinker with and > disassemble things as I'm learning about them. I would have been > ecstatic about open source as a kid. I learn simultaneously from the > top down and bottom up -- outside to inside

Re: [Tutor] help me

2014-03-10 Thread Peter Otten
hind fathallah wrote: > hi I need your help plz with this cods ( I want u to tell wht cod I miss > to stop the while loop whene I get 3 stars) rm = [] I think you are comparing a string and an integer. That gives False even if the values look the same: >>> i = 3 >>> s = "3" >>> print i, s 3 3

Re: [Tutor] help me

2014-03-10 Thread Dave Angel
hind fathallah Wrote in message: > > > while rm != stars:         print\         """         0 - Northe         1 - South         2 - East         3 - Weast         """         rm = raw_input("What room you want to go?: ") Why are you looping till he gets to th

Re: [Tutor] help me

2014-03-10 Thread hind fathallah
hi I need your help plz with this cods ( I want u to  tell wht cod I miss to stop the while loop whene I get 3 stars)  rm = [] stars = 0 ##if stars == "3": ##    print " You win" ##else: ##    print "hh" def ask_yes_no(question):     """Ask a yes or no question."""     answer = None        while a

Re: [Tutor] improvements on a renaming script

2014-03-10 Thread Pavan Rikhi
On Sun, Mar 09, 2014 at 03:22:35PM -0400, street.swee...@mailworks.org wrote: > - In the get_long_names() function, the for/if thing is reading > the whole fileNames.tab file every time, isn't it? In reality, > the file was only a few dozen lines long, so I suppose it doesn't > matter, but is ther

Re: [Tutor] Help with Guess the number script

2014-03-10 Thread eryksun
On Mon, Mar 10, 2014 at 5:29 AM, Mark Lawrence wrote: > > As a newbie don't worry about it (yet). Personally I think it's plain daft > to put such advanced language topics on a tutor mailing list. Different strokes for different folks. I like to tinker with and disassemble things as I'm learning

Re: [Tutor] Help with Guess the number script

2014-03-10 Thread Mark Lawrence
On 10/03/2014 02:03, Scott W Dunning wrote: On Mar 8, 2014, at 7:29 AM, 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 us

Re: [Tutor] Help with Guess the number script

2014-03-10 Thread Mark Lawrence
On 10/03/2014 02:05, Scott W Dunning wrote: On Mar 8, 2014, at 7:35 AM, Mark Lawrence wrote: I have no interest in the efficiency, only what is easiest for me to read, which in this case is the chained comparison. As a rule of thumb I'd also prefer it to be logically correct :) What exac

Re: [Tutor] Help with Guess the number script

2014-03-10 Thread Scott W Dunning
On Mar 8, 2014, at 7:35 AM, Mark Lawrence wrote: > > I have no interest in the efficiency, only what is easiest for me to read, > which in this case is the chained comparison. As a rule of thumb I'd also > prefer it to be logically correct :) > What exactly is ment by a chained comparison?

Re: [Tutor] Help with Guess the number script

2014-03-10 Thread Scott W Dunning
On Mar 8, 2014, at 7:29 AM, eryksun wrote: > i.e. > >guess < 1 or guess > 100 > > becomes > >not not (guess < 1 or guess > 100) Why a not not? Wouldn’t that just be saying do this because the second not is undoing the first? > > distribute over the disjunction > >not (not (gue

Re: [Tutor] improvements on a renaming script

2014-03-10 Thread Cameron Simpson
On 09Mar2014 22:50, bob gailer wrote: > Beware using tabs as indents. As rendered by Thunderbird they appear > as 8 spaces which is IMHO overkill. > It is much better to use spaces. Most Python IDEs have an option to > convert tabs to spaces. Further to this remark, this isn't an instruction to n

Re: [Tutor] improvements on a renaming script

2014-03-10 Thread Cameron Simpson
On 09Mar2014 15:22, street.swee...@mailworks.org wrote: > A bit of background, I had some slides scanned and a 3-character > slice of the file name indicates what roll of film it was. > This is recorded in a tab-separated file called fileNames.tab. > Its content looks something like: > > p01