Vidyalelo
Python · Q42

Python Introduction and basic

Programming · Python · question 42

Q42

What will be the output of the following Python function? min(max(False,-3,-4), 2,7)

A.
-4
B.
-3
C.
2
D.
False
Answer

Answer: Option D

Solution

Answer: Option D
Solution:
In Python, the boolean value False evaluates to 0 in numeric contexts.
The max() function returns the largest of the given arguments.
Here, we have the expression max(False, -3, -4).
Since False is equivalent to 0, and -3 and -4 are numeric values, the largest value among them is 0.
Therefore, the output of max(False, -3, -4) is False.
The min() function then evaluates min(False, 2, 7), and since False evaluates to 0 and 2 and 7 are greater than 0, the minimum value among them is False.
Hence, the overall output is False.