Path: csiph.com!usenet.pasdenom.info!news.etla.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.013 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'true,': 0.05; 'matches': 0.07; 'subject:help': 0.08; 'string': 0.09; 'false,': 0.09; 'whatever.': 0.09; '12:57': 0.16; 'responses.': 0.16; 'wrote:': 0.18; 'programming': 0.22; 'this?': 0.23; 'header:User-Agent:1': 0.23; 'helpful': 0.24; 'question': 0.24; 'header:In-Reply-To:1': 0.27; 'comparison': 0.31; 'responded': 0.31; "user's": 0.31; 'checking': 0.33; 'something': 0.35; 'no,': 0.35; 'to:addr:python- list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'email addr:gmail.com': 0.63; 'received:74.208': 0.68; 'saw': 0.77; 'received:74.208.4.194': 0.84; 'convenience,': 0.91 Date: Tue, 09 Apr 2013 13:27:52 -0400 From: Dave Angel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130308 Thunderbird/17.0.4 MIME-Version: 1.0 To: python-list@python.org Subject: Re: While loop help References: <596ca4b8-b5aa-4112-b086-6320108075f7@googlegroups.com> <1629a072-c512-439c-b751-c44f8e945c2e@googlegroups.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:R8Gxbg2o1dG2+nGlt7NcmRb0FlFfxXNaeQK/apHSkJf hk92P4EDJmLxfMl21eUFw0zM8nP6DjKdv2rexsMgGkua5GvjC3 wDk4QTOLOeInRpVsDFMMo4wg2FP1m0S1O3QYgXKC7AUz+1aIt5 NoAn2gGNzvMugi4maGWL9mQfC6cmFMYuh5969+gaZt6CteZu2K Pl3gyqDI0cyA0Buj2xGv7XaIGAhHZc3ae60NoHt04efdsimK46 QFoctUSKdpxdvYLQC0ESnzxObIfI2MbpdJFgzg5RGLMDMFa0w9 YWtAMFaQbGiGrqvO2MEdXEh1exJQIf/TDwX1qinqQ7CwOyXgA= = X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 17 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1365528500 news.xs4all.nl 2595 [2001:888:2000:d::a6]:42900 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:43207 On 04/09/2013 12:57 PM, thomasancilleri@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