I wrote a code like this:
print(1 and 9) #print 9
I thought that 1 evaluates to True and 9 evaluates to True as well. So True and True
should be 1 right? But in here it is 9.
I wrote a code like this:
print(1 and 9) #print 9
I thought that 1 evaluates to True and 9 evaluates to True as well. So True and True
should be 1 right? But in here it is 9.
From the docs:
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.
You can see it by help function too:
help("and")