What will be the output of the following Python code? print(min(max(False, -2,…

2026

What will be the output of the following Python code?

print(min(max(False, -2, -5), 2, 5))

  1. A.

    -2

  2. B.

    2

  3. C.

    False

  4. D.

    -5

Attempted by 173 students.

Show answer & explanation

Correct answer: C

In Python, boolean values are treated as integers in numeric comparisons where False equals 0 and True equals 1. First, evaluate the inner function max(False, -2, -5). Since False is 0, and 0 is greater than both -2 and -5, max returns False. Next, evaluate the outer function min(False, 2, 5). Since False is 0, and 0 is less than both 2 and 5, min returns False. Therefore, the final output printed is False.

Explore the full course: Rssb Senior Computer Instructor