Jul-10-2022, 02:48 PM
I'm reading an intro to Python book and it gives these examples:
> The computer will evaluate the left expression first, and then it will evaluate the
> right expression. When it knows the Boolean value for each, it will then evaluate
> the whole expression down to one Boolean value.
This feels intuitively right to me. However, I thought a while back I asked about some weird results I was getting with this sort of thing involving and/or and the reason it didn't turn out as I expected was because once one part was deemed to be False, it did not process the remainder of the expression. I can't remember if that was dealing with and or or.
Does anyone know what I might be misremembering or confused about here? Thanks!
>>> (4 < 5) and (5 < 6) True >>> (4 < 5) and (9 < 6) False >>> (1 == 2) or (2 == 2) TrueThen it says:
> The computer will evaluate the left expression first, and then it will evaluate the
> right expression. When it knows the Boolean value for each, it will then evaluate
> the whole expression down to one Boolean value.
This feels intuitively right to me. However, I thought a while back I asked about some weird results I was getting with this sort of thing involving and/or and the reason it didn't turn out as I expected was because once one part was deemed to be False, it did not process the remainder of the expression. I can't remember if that was dealing with and or or.
Does anyone know what I might be misremembering or confused about here? Thanks!