I wrote a program which I tested in the IDE of python 3.2, it worked but whenever I open the program directly or run from command prompt, it doesn't run correctly, after the user inputs the correct answer, the program keeps saying try again. here's the program it's in the code snippet area
I tried it in python 3.1 command line and it worked.
Any suggestions, Is this a bug.

Recommended Answers

All 5 Replies

That mean you got a logic error. check your while and if loops well.

I'll check it out. But it did run fine in the IDLE. :)
Thanks all the same.

Works for me using Python 3.2 (r32:88452, Feb 20 2011, 11:12:31)

You have misspelled Torvalds, however.

There is a bug with python 3.2 and command line output from input()
It put on a '\r' character on input() when run from command line.
This will be fix in in 3.3 (r88530) and 3.2 (r88531). Others versions are not affected.

A temporay fix is to use strip()
guess = input('Your guess\n').strip()

Thanks for that, i will try and use the .strip()
Thanks to all that posted in this thread.
I've have corrected the spelling in the edited version of the program thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.