On 05/08/17 19:28, Howard Lawrence wrote:
> if guess_value != number:
> number = str(number)
> print ('nope. the number i was thinking of was ' + number)
There is the problem, you convert number to a str before printing
it. so next iteration of the loop your if test fails.
You don't need the conversion in this case because print does it
automatically. If you did need it for some other purpose then
you should store the result in a temp variable rather than
in number itself.
This is a good example of why you should post the whole of your
code not just the snippet that you think is causing the problem...
If you had posted this in the first message we would probably
have spotted it right away.
Author of the Learn to Program web site
Follow my photo-blog on Flickr at:
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options: