Home »
MCQs »
Python MCQs
What will be the output of the following Python code? Question 3
31. What will be the output of the following Python code?
x=13
if x>12 or x<15 and x==16:
print("Given condition matched")
else:
print("Given condition did not match")
- Given condition matched
- Given condition did not match
- Both A and B
- None of the mentioned above
Answer: A) Given condition matched
Explanation:
In this code the value of x = 13, and the condition 13>12 or 13<15 is true but 13==16 becomes falls. So, the if part will not execute and program control will switch to the else part of the program and output will be "Given condition did not match".