If you use and on two or more non-zero numbers then the last number would be printed as output. If one of those numbers is 0 then 0 will be the output.
print (a and b)
Here b is the last number and because a is not zero, b is printed.
print (b and a)
And in this case, a is the last number and because b is not zero, a is printed.