[True,False,True,False] and [True,True,False,False]
it returns :
[True, True, False, False]
Why is the second element is True
?
[True,False,True,False] and [True,True,False,False]
it returns :
[True, True, False, False]
Why is the second element is True
?
Because Python doesn't do element-wise vector operations like that. The way the normal and
operator works is, if the first operand has a "true" value, then the result is the second value. Your first list is not empty, so it's true, so it returned the entire second list.
The numpy
module does element-wise operations like that, but not straight Python.