Just open up python and test it yourself, takes around 1 min:
assert ([1,2,3] and [4,5,6]) == [4,5,6]
Occasionally useful (but completely unreadable)
Just open up python and test it yourself, takes around 1 min:
assert ([1,2,3] and [4,5,6]) == [4,5,6]
Occasionally useful (but completely unreadable)
sry, bad example. The ==
sign will return a bool but and
won’t.
print([1,2,3]and[4,5,6])
Ah gotcha. Why does Python pick [4, 5, 6]
?
You can read the docs.
The expression
x and y
first evaluatesx
; ifx
is false, its value is returned; otherwise,y
is evaluated and the resulting value is returned.
The expressionx or y
first evaluatesx
; ifx
is true, its value is returned; otherwise,y
is evaluated and the resulting value is returned.