On Thu, 4 Oct 2007, Jerry VanBrimmer wrote:

> I'm no Python wizard, I'm still learning myself. But I think you need
> another "if" statement to check if "guess" is equal to "number".
> 
> if guess == number:
>     print "Congratulations!"

No, he's got the equivalent function in his while statement:

while (guess != number):

The idea is to stay in the loop as long as they're UNequal, and then drop 
out to the "Congratulations" part.

But comparing floats as equal or not equal is never a very robust idea.
http://www.python.org/doc/faq/general/#why-are-floating-point-calculations-so-inaccurate


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

Reply via email to