Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Bob Gailer Newsgroups: comp.lang.python Subject: Re: Conditionals And Control Flows Date: Wed, 4 May 2016 10:54:03 -0400 Lines: 29 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de ALz35/wcgzhAvORQ8ksk0QZb18vxrxKKsCRKxWft36Jg== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'operator': 0.03; 'true)': 0.07; 'cc:addr:python-list': 0.09; 'caveat': 0.09; 'false)': 0.09; 'statements': 0.09; 'python': 0.10; 'python.': 0.11; 'argument': 0.15; '"and"': 0.16; '10:45': 0.16; '2016': 0.16; 'boolean': 0.16; 'cc:name:python list': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; '<': 0.18; 'instance,': 0.18; '>': 0.18; 'email addr:gmail.com>': 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'trying': 0.22; 'am,': 0.23; 'header:In-Reply-To:1': 0.24; 'example': 0.26; 'message-id:@mail.gmail.com': 0.27; 'correct': 0.28; '---': 0.28; 'operators': 0.29; 'supposed': 0.31; 'statement': 0.32; 'received:google.com': 0.35; 'false': 0.35; 'should': 0.36; 'received:209.85': 0.36; 'subject:: ': 0.37; 'skip:& 10': 0.37; 'received:209': 0.38; 'received:209.85.220': 0.38; 'determine': 0.61; 'results': 0.66; 'subject:Control': 0.84 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:to :cc; bh=INwri2AqbOQ2jOGindj7cznzbBfQAZ71M/m7kml6ocY=; b=XrYEHFHQk+36Vh3AYVYo3x2E3WzIykjMqrhrL8KIyCjASw9Z2/Y1/LDnRPNtARgLIm vuXeYioGLCE+X30H0Ut+cB0yNGbbt6aTbE0zDEXCL/Sv5VfVC2yXWNqZbPhf8f7vZn/C CSa2lI7aF0zdIuh3/O+2HCRkQu6DE0KlJ+J5X1I1oObQmxm31DbQIMvjJfjAnuZI1S0I QvfQRiiVGuaTY1lh1Db0c3IMHCyz2caNRRUKoP5N/3HTiwwmFsGUQOR0rYC0/HvdggqV rhBPKd5St/4nmn6NkSY8N2rQmhNO4CLIDVUEnMqfBRWpxSNTfCYj/vDbqgmpssEfBdig Zg4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=INwri2AqbOQ2jOGindj7cznzbBfQAZ71M/m7kml6ocY=; b=knRYUeYoqQ/3zth6i2c7Xjba1Y28+0h8R38e6uCFkwcUrkxI0SSz6NbuQ8vdPfFrX8 ZbyNjuj3Nh0NrF3qOcEbgAqulsi7bSgTShFc8cdg5T2sMVfcon9xXe22qQ9ohLK8dKj/ vfugoNlh8r4c3zW1L3s6Ce8Zj46lnK3rRUyfHiHmPr7VcEu3Au8bZq+6PKRqjvq2BHzQ Oj45GA26vSHZjA/L0MrK3dGWHjSXtnu0cGZISYD0+fX37ir1TAEo5XzA3Go9Jeyz4+YT CuC/yE4vbss6q488uyTyCF4gpXkzUQK47kfTskBSYZAcfE6PX1aS9iUky9oAVrDQzBLK KQRQ== X-Gm-Message-State: AOPr4FVL1kYZ9nfcXWNujrJ8/NQfCLzyVdnw/eqjq52Ukza5+68FERM6OoHkAZFR3Dzz0ovJw2MXC4hp1knzZA== X-Received: by 10.55.178.198 with SMTP id b189mr8466096qkf.98.1462373643959; Wed, 04 May 2016 07:54:03 -0700 (PDT) In-Reply-To: X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: Xref: csiph.com comp.lang.python:108135 On May 4, 2016 10:45 AM, "Cai Gengyang" wrote: > > I am trying to understand the boolean operator "and" in Python. It is supposed to return "True" when the expression on both sides of "and" are true > > For instance, > > 1 < 3 and 10 < 20 is True --- (because both statements are true) > 1 < 5 and 5 > 12 is False --- (because both statements are false) > > bool_one = False and False --- This should give False because none of the statements are False > bool_two = True and False --- This should give False because only 1 statement is True > bool_three = False and True --- This should give False because only 1 statement is True > bool_five = True and True --- This should give True because only 1 statement is True > > Am I correct ? Yes. Caveat : python Boolean operators return the value of the last argument necessary to determine the outcome. Example : 2 or 3 results in 2 2 and 3 results in 3. 0 and 3 results in 0. HTH.