In my program encountered with this:
>>> True and True and (3 or True)
3
>>> True and True and ('asd' or True)
'asd'
while I expected to get some boolean value depending on the result in brackets. So if I try comparisons like these (0 or True)
or ('' or True)
python will return True
, which is clear because 0
and ''
equivalent to False
in comparisons.
Why doesn't python return boolean value by converting 3
and 'asd'
into True
?