ExamVeda
Login
Home
Python Built In Functions
?

What will be the output of the following Python function?
any([2>8, 4>2, 1>2])

Answer & Solution
Correct Answer: Option B
The any() function in Python returns True if at least one element of the iterable is true, otherwise it returns False.
In the provided code, the list [2>8, 4>2, 1>2] contains three boolean expressions:

2>8 evaluates to False.
4>2 evaluates to True.
1>2 evaluates to False.
Since at least one of the expressions (4>2) is true, the any() function returns True.
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.