+ 13

# Why>>> False == (False or True) False

Why the output of the code is false .it should be true because "or" take two arguments and if one of them is true the answer is true.

11 Answers

+ 7

In 'or', if either or both side are true, the output is true, so in 'true or false' situation the output is true, and with the brackets on the first operation is the 'true or false' statement that will result true, and then the comparison will take place, and it would be 'false == true', which result 'false'...
Try this, it may help you understand:
Print(false == true or true)
The beginning 'false == true' should output false, and there u got it, false or true, it will output true...
Even if its:
Print(6 == 8 or true)
The second statement is true, so as we have said, in 'or' if either or both statements are true, then the output is true...
try thinking it in that way, in case of 'or' you need to divide it to two statements, the left statement, and the right statement, if at least one of them output 'True', then the total output is true...
so, for example, in case of:"false == 6 or false"
the wrong way to calculate it would be:
"false == 6 or false == false"
but this:
"false == 6, which output false" or false

+ 7

The or operator takes 2 conditional and returns True if either one of them is True. Because of this, the expression is the same thing as False == True, which is False.

+ 5

But there is also second expression which is False==False
And this is true.so it should be true

+ 5

Faisal see this https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2280/
The second example

+ 5

(False or True) will result in True because the or will give True if at least one of the operands is True. Then, False == True will result in False. Read this way, it might help you: "is False the same thing as True?" No, right? So, it is False.

+ 3

Nishant Saini It seems to be only that 1 expression đ€·ââïž
Is there another part of the code you left out?

+ 3

here's a step by step solution
False == (False or True)
---------------------------------------
False or True
>>>
True
---------------------------------------
False == (True)
False == True
>>>
False

+ 3

= 0 == (1||0) - bitwise OR
= 0 == (1)
= False

+ 2

Remember your BEDMAS đ. â==â will go before âorâ unless if there is brackets.

+ 1

False == (False or True) = False == True = False
False doesnt equal true, so its false.

+ 1

Consider false as 0 and true as 1 then apply Boolean rule
U will get your answer