On 04/09/2013 12:57 PM, thomasancill...@gmail.com wrote:
I responded before I saw this message, this was very helpful so I appreciate 
your quick and helpful responses. So do you think prompting for a string and 
then checking if the string is true is a good practice for something like this? 
When would checking for true/false be necessary?


No, DON'T check for the string to be true, check if it matches the requirements. Word the question for the user's convenience, not the programming language's. Don't ask for true and false, ask "Continue?" and accept "Y" or "N". Or ask "Q for quit". Or whatever. Make your comparison case-insensitive, and permit one-character responses.

continue = "y"
while continue[:1].lower() == "y":
    do some work
    continue = raw_input("Do you want to continue (y/n)?"

--
DaveA
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to