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 RĂ©ponse
+ 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