Python Programming - Operators - Discussion

Discussion Forum : Operators - General Questions (Q.No. 10)
10.
What is the output of the following code?
x = True
y = False
result = not x or y

print(result)
True
False
None
Error
Answer: Option
Explanation:
The not operator is used to negate the value of a boolean expression. In the code, not x means not True, which is False. The or operator returns True if at least one of the expressions is True. So, the expression not x or y becomes False or False, which evaluates to False.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.