Path: csiph.com!aioe.org!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Ben Bacarisse Newsgroups: comp.lang.python Subject: Re: Conditionals And Control Flows Date: Wed, 04 May 2016 16:21:58 +0100 Organization: A noiseless patient Spider Lines: 42 Message-ID: <87pot1vofd.fsf@bsb.me.uk> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="017616aa25f81ec581c44d76d61ba2f3"; logging-data="20581"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19lFTgULMhrcY5g7e029RHdTv7maWuStLI=" Cancel-Lock: sha1:bVC8gBefmPnnfgP2jrLh09Q3JRs= sha1:5efV8ThiNM+fprFCMsKTanXKJfs= X-BSB-Auth: 1.71bccdbc4fa76b7a2390.20160504162158BST.87pot1vofd.fsf@bsb.me.uk Xref: csiph.com comp.lang.python:108139 Jussi Piitulainen writes: > Cai Gengyang writes: > >> 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) > > Yes. > >> 1 < 5 and 5 > 12 is False --- (because both statements are false) > > No :) > >> 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 > > Yes. > >> bool_five = True and True --- This should give True because only 1 >> statement is True > > No :) > >> Am I correct ? > > Somewhat. Just an observation on the language... Change "only 1 statement" to "only statement 1" and you get much closer to a correct explanation. -- Ben.