0
ānot Falseā is still āFalseā?!
x = [0, 0, 0] y = [1, 1, 1] b = x and y print(not b) So far I know that āx and yā is āFalseā because they have different elements. So why āprint(not False)ā is still āFalseā rather than āTrueā?
1 Answer
+ 4
Check also what is the result of
print(b)
It actually results in the second list (y)
You cannot compare lists like this. The 'and' operator evaluates both operands and they are both true (because a non-empty list is considered True by python) and the last operand is returned.
So 'not b' is negating the True value of the result (the non-empty list).
I hope that makes sense.
Look also here:
https://stackoverflow.com/questions/47419342/logical-operation-between-two-boolean-lists/47419399