Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!nntp.club.cc.cmu.edu!micro-heart-of-gold.mit.edu!bloom-beacon.mit.edu!panix!gordon From: John Gordon Newsgroups: comp.lang.python Subject: Re: Novice Issue Date: Thu, 18 Apr 2013 14:21:36 +0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Lines: 22 Message-ID: References: <0fa050c1-3a00-4c17-9fa6-b79a22485c7a@googlegroups.com> NNTP-Posting-Host: panix2.panix.com X-Trace: reader1.panix.com 1366294896 16313 166.84.1.2 (18 Apr 2013 14:21:36 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Thu, 18 Apr 2013 14:21:36 +0000 (UTC) User-Agent: nn/6.7.3 Xref: csiph.com comp.lang.python:43832 In <0fa050c1-3a00-4c17-9fa6-b79a22485c7a@googlegroups.com> Bradley Wright writes: > while raw_input != "quit" or "q": Others have pointed out flaws in this statement. However, even if you had written the loop the 'correct' way: user_input = raw_input() while user_input != "quit" or user_input != "q": There is still a logic bug. This loop will execute forever, because no matter what the user enters, it will be unequal to "q" or unequal to "quit". Use 'and' instead of 'or'. Of course in this specific situation, as others have suggested, 'in' is better still. -- John Gordon A is for Amy, who fell down the stairs gordon@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies"