Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3a.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.014 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'logic': 0.09; 'subject:while': 0.09; 'cc:addr:python-list': 0.11; "wouldn't": 0.14; 'ans': 0.16; 'boolean': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'redundant,': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'mon,': 0.24; 'cc:2**0': 0.24; 'equivalent': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; '13,': 0.31; 'but': 0.35; 'received:google.com': 0.35; 'version': 0.36; 'first': 0.61; 'to:none': 0.92; 'taught': 0.96 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=rCxvF3TQhOPf9+tPSSEXKx5EQa4tFuWFAy3Sp1jJB2w=; b=oS4MQcKLRRrKJgRg4LvTrfKVU9atvBb+T+qLyTVStj1Q+oW8CfdKmGrDpSICkYLEv+ VblrQhorSWe71ckvLEkO0KtQtmFkTZdBJzfZ/p4R0WEjuOumOFdUNAbZiUUjzjJVQVZF 63OJIZ48mlDVWYgUtVgA5Z10OM5i/8GnJZx9Eu/ejd/qs0qcVz36WJl+tf7tpjShzd5S jZRuo0v/eH5bXZ51iJYZ1tW+W/uWzlzpqidsdiNDeCrQZh3GiyPzm54jhAShbOqBJvlO j91YS1+Z6xnSXpxoNyzlGerZNZ33AC4KOqUGsmey7jR1n9xYG4KyUV5qBYqmPpqY67wM 81Ig== MIME-Version: 1.0 X-Received: by 10.42.92.129 with SMTP id t1mr30410058icm.59.1413141744186; Sun, 12 Oct 2014 12:22:24 -0700 (PDT) In-Reply-To: <878uklcd3r.fsf@elektro.pacujo.net> References: <878uklcd3r.fsf@elektro.pacujo.net> Date: Mon, 13 Oct 2014 06:22:24 +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: 14 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1413141753 news.xs4all.nl 2847 [2001:888:2000:d::a6]:41648 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:79018 On Mon, Oct 13, 2014 at 6:16 AM, Marko Rauhamaa wrote: > The corrected version > > while ans.lower() != 'yes' and ans.lower()[0] != 'y': > ans = input('Do you like python?') > > is equivalent with > > while ans.lower()[0] != 'y': It's true that the first part is redundant, but trimming that out wouldn't have taught the OP about boolean logic :) ChrisA