On Thu, 4 Oct 2007, Jim Hutchinson wrote:

>  Any idea what I'm doing wrong? 

> while (guess != number):

This is your problem.  Like all^h^h^h most numbers in computing, floating
point numbers are stored in binary.  They only approximate the decimal
values they print out as.

Two numbers can print as the same value but actually have different 
values.

If you want to see if the numbers are identical to 10 decimal places, use 
this instead:

while (abs(guess-number) > 0.0000000001):


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to