Python · Question 30 · Hard

What will be the output of the following Python code?

print(1 < 3 > 2 == 2, (1 < 3) > 2)
  1. True False
  2. True True
  3. False False
  4. False True
Answer and explanation

Answer: A. True False

Explanation: A chain like 1 < 3 > 2 == 2 means 1 < 3 and 3 > 2 and 2 == 2, which is True. In (1 < 3) > 2 the bracket gives True, which acts as 1, and 1 > 2 is False.

Previous: What will be the output of the following Python code?

Practise python

Try a fresh set of python questions with an explanation after every answer, free and without signing up: Python practice. Or sit a full placement mock test.

More python questions

More technical & programming practice

Data Structures · Algorithms · Object-Oriented Programming · DBMS · SQL · Operating Systems · Computer Networks · Software Engineering

LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge