On 09/27/2017 12:23 AM, Cai Gengyang wrote: > > I'm trying to understand the logic behind AND. I looked up Python logic tables > > False and False gives False > False and True gives False > True and False gives False > True and True gives True. > > So does that mean that the way 'and' works in Python is that both terms must > be True (1) for the entire expression to be True ? Why is it defined that > way, weird ? I was always under the impression that 'and' means that when you > have both terms the same, ie either True and True or False and False , then > it gives True
There is nothing Python specific about this, by the way. It is how AND - ∧ - has been defined in Boolean Algebra forever. It's a logical conjunction of its operands, it doesn't test for the 'equality' of its operands. https://en.wikipedia.org/wiki/Logical_conjunction Irmen -- https://mail.python.org/mailman/listinfo/python-list