ExamVeda
Login
Home
Python Built In Functions
?

Which built-in function is used to check if all elements in an iterable are true?

Answer & Solution
Correct Answer: Option A
The correct answer is Option A: all().
The all() function in Python is used to check if all elements in an iterable are true.
It takes an iterable as an argument and returns True if all elements in the iterable are true, otherwise False.
For example:
my_list = [True, True, True]
result = all(my_list)
print(result)  # Output: True
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.