Boolean Expressions
Rob Gaddi
rgaddi at highlandtechnology.invalid
Tue Sep 26 18:30:29 EDT 2017
More information about the Python-list mailing list
Tue Sep 26 18:30:29 EDT 2017
- Previous message (by thread): Boolean Expressions
- Next message (by thread): Boolean Expressions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 09/26/2017 03:23 PM, 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 > No, that would actually be an xnor (not xor) operation, a fairly rare usage case. Python doesn't even provide an operator for that, the closest thing would be (bool(x) == bool(y)). "And" means "and". This is true AND that is true. -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is currently out of order. See above to fix.
- Previous message (by thread): Boolean Expressions
- Next message (by thread): Boolean Expressions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list