Examveda
Examveda

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

A. all()

B. every()

C. true()

D. check()

Answer: Option A

Solution(By Examveda Team)

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

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

Join The Discussion

Related Questions on Python Built In Functions