Newb ??

Fredrik Lundh fredrik at pythonware.com
Fri Nov 11 16:48:38 CET 2005


Norman Silverstone wrote:

> > did you test the script?  here's a simulator:
>
> < snip>
>
> Fredrik, thank you very much indeed for taking the trouble to show me the
> way. I am sorry that I made the comment I did, that will teach me to read
> more carefully. It is said that there is no fool like an old fool and, as
> I am approaching 78 years old, I think I qualify. It is also said that you
> are never too old to learn so I am trying.
>
> Now, I put the script you gave into an editor and ran it , (I use Ubuntu
> Linux by the way). It certainly showed how the computer arrived at the
> number guessed but guessed the number itself and gave me no chance to say
> whether high or low. I noticed also that the numbers were all greater than
> 50 and the loop ran until the number guessed was 100, then it stopped.
> Perhaps you can point out to me how I should go about debugging.

debugging?  the script I posted was intended to show you that given an
honest human (simulated by the raw_input function), the posted algorithm
found the right answer for all values in the given range.  (if the algorithm
had been broken, the simulator wouldn't have finished).

if you want to play yourself, use Steven's original code, and follow the in-
structions...

</F>






More information about the Python-list mailing list