+ 5
Why the following code evaluates to zero? Why not False? print(False or 0)
4 Respostas
+ 2
there is no distinction between them, so if you try
print(0 or False) you will get False
+ 2
some more explanation:
The expression x and y first evaluates x; if x is false, its value is returned; otherwise, y is evaluated and the resulting value is returned.
because both of them are False, 'print()' will print a second value.
0
So the second one will be the output.
0
thank you!