Identify the correct output of the following Python Command : print (10 or 40)

2023

Identify the correct output of the following Python Command : print (10 or 40)

Answer: A. 10In Python, the or operator returns the first truthy value. Since 10 is truthy, Python returns 10 without checking 40.

  1. A.

    10

  2. B.

    40

  3. C.

    50

  4. D.

    400

Attempted by 2313 students.

Show answer & explanation

Correct answer: A

In Python, the or operator returns the first truthy value. Since 10 is truthy, Python returns 10 without checking 40.

Explore the full course: Hpsc Pgt Computer Science

Loading lesson…