Vidyalelo
Python · Q16

Python Built

Programming · Python · question 16

Q16

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

A.
TRUE
Answer
B.
[True, False, True]
C.
FALSE
D.
Error

Answer: Option A

Solution

Answer: Option A
Solution:
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.