Examveda

What is the output of the following code:
my_list = [True, False, True]
print(any(my_list))

A. TRUE

B. [True, False, True]

C. FALSE

D. Error

Answer: Option A

Solution (By Examveda Team)

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 [True, False, True] contains at least one True value, so the any() function returns True.

This Question Belongs to Python Program >> Python Built In Functions

Join The Discussion

Related Questions on Python Built In Functions