?
What is the output of the following code:
What is the output of the following code:
my_list = [True, False, True]
print(any(my_list))
print(any(my_list))
Answer & Solution
Correct Answer:
Option
A
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.
In the provided code, the list [True, False, True] contains at least one True value, so the any() function returns True.
Join the Discussion
Login to post a comment or share your explanation.
Login