Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!bcyclone01.am1.xlned.com!bcyclone01.am1.xlned.com!newsfeed.xs4all.nl!newsfeed2a.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.015 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'doing?': 0.09; 'subject:while': 0.09; 'cc:addr:python-list': 0.11; '"or"': 0.16; 'ans': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'means.': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'mon,': 0.24; 'cc:2**0': 0.24; 'second': 0.26; 'header:In-Reply- To:1': 0.27; 'am,': 0.29; "doesn't": 0.30; 'message- id:@mail.gmail.com': 0.30; '13,': 0.31; 'but': 0.35; 'received:google.com': 0.35; 'should': 0.36; 'being': 0.38; 'either': 0.39; 'break.': 0.84; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=iRnSonmgz1NBQQx9/7XPnbYbBeex08IuUbiZmKDSFeg=; b=QuyN1ObE9xck+qCDzCnGzLa6JaaSM2VQZeDt9ONfE8lAfdFyUGgsMRmwqN/Iq1sQcQ v97pMif6FhzaD4K9Q26nzv7FjcZJfctf1HJ4JS8VRMPZw2jg9F5GI79BRmCRkQdzzgYg bac2S6RCl0YZhjr1RtXzSebl5jN4uR9Sm3RdAuKny6i7omFv/OVldfZGvICuu39Kj2KS uIJx9EaH8p+nUgRmVWjIuJENiVle5CU03MeAMlGt2QZEOzOvRroRYAB1onL6+YPqDRvp w0u6FS5vBHsYYe5Kbu2fwRlI7+bvCQEY64EMdMzLzj5mlCqf8RhKhKTFYSlbrJO0dsam yZow== MIME-Version: 1.0 X-Received: by 10.42.92.129 with SMTP id t1mr29809282icm.59.1413133984426; Sun, 12 Oct 2014 10:13:04 -0700 (PDT) In-Reply-To: References: Date: Mon, 13 Oct 2014 04:13:04 +1100 Subject: Re: while loop - multiple condition From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 15 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1413133987 news.xs4all.nl 2924 [2001:888:2000:d::a6]:60629 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 3340 X-Received-Body-CRC: 3831961264 Xref: csiph.com comp.lang.python:79006 On Mon, Oct 13, 2014 at 4:08 AM, Shiva wrote: > Why is the second part of while condition not being checked? > > while ans.lower() != 'yes' or ans.lower()[0] != 'y': > ans = input('Do you like python?') > > > My intention is if either of the conditions are true the loop should break. > But the condition after 'or' doesn't seem to evaluate. The loop will continue while either part is true - that's what "or" means. Is that what you intended it to be doing? ChrisA