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")
  1. Given condition matched
  2. Given condition did not match
  3. Both A and B
  4. 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".

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.