Python · Question 20 · Easy

What will be the output of the following Python code?

print(10 or 20, 0 and 5)
  1. 10 5
  2. True False
  3. 10 0
  4. 20 5
Answer and explanation

Answer: C. 10 0

Explanation: or returns the first truthy operand, so 10 or 20 is 10. and returns the first falsy operand, so 0 and 5 is 0.

Previous: What will be the output of the following Python code? · Next: 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