What will be the output after the following statements?
x = True
y = False
print(x or y)
Answers
Answered by
0
Answer:
True
Explanation: It follows OR gate logic i.e the value will always be true until x and y both are set false.
Answered by
1
Concept:
The or keyword is a logical operator.
To combine conditional statements, logical operators are needed.
Given:
x = True
y = False
print(x or y)
Find:
Find the output of the following code.
Solution:
The value of or operator will be True if at least one of the statements returns True, otherwise, it will return False.
The truth table for or operator is as follows.
X Y OUTPUT
False False False
False True True
True False True
True True True
Since, in the given code, x = True and y = False
∴ The output of x or y will be True.
Similar questions