Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.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.024 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'output': 0.05; 'correct,': 0.09; 'subject:while': 0.09; 'cc:addr:python-list': 0.11; '(also': 0.16; '4:59': 0.16; 'fine.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'loop.': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'cc:addr:python.org': 0.22; 'mon,': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message- id:@mail.gmail.com': 0.30; '13,': 0.31; 'operators': 0.31; 'received:google.com': 0.35; 'false': 0.36; 'opposed': 0.36; 'should': 0.36; 'called': 0.40; 'break': 0.61; "you're": 0.61; 'here': 0.66; "'and'": 0.84; 'confusing': 0.84; 'important;': 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=EKa1/rLFDy/n8EYCdbG1axbZcjrjkY2unGtI68BW1c0=; b=ylCT6OtrxAuCg6ZQnC7IAlNaWlngaOd46qLmaFHWfVSGM6OTSA57cUJeO7YyUxyOk3 Iw+w1lzNIx6lB864ttmfCo71D7T02l/KSm815NMTiKlQao5T/RzUmhb231bV+wc4R43B gIybPjUYZHMvHBQXfSM0O6VyW6a7l71D5x17fqIQ+aRxw3HJjITpgWB2dw0rbTJDUvuX pYPhV0EJ3IvmHb8H2I0VTyrXcdglPZpG/YhbO2rXjULKdfiC8Dqr0JuHGFbgWf5QFYZb +7xUoLL2UzatsDSHWSMhr7OQsc4208pT0jYGMXaGqmCC+7LB309U4FKS7LtBPOyeOmtt fC4w== MIME-Version: 1.0 X-Received: by 10.51.17.2 with SMTP id ga2mr24779136igd.2.1413137012016; Sun, 12 Oct 2014 11:03:32 -0700 (PDT) In-Reply-To: References: Date: Mon, 13 Oct 2014 05:03:31 +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: 13 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1413137019 news.xs4all.nl 2941 [2001:888:2000:d::a6]:50136 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:79012 On Mon, Oct 13, 2014 at 4:59 AM, Shiva wrote: > Bit confusing to use in While loop - Should have used the 'and' condition > instead of OR- then it works fine. > for OR both condition need to be false to produce a false output and break > the loop. Correct, what you're looking for here is indeed an 'and' (also called a conjunction, as opposed to the disjunction of 'or'). Both operators are important; and you need to understand what they do so you know when to use each. ChrisA