Python Check if All Items of Tuple are True

To check if all items of a Tuple are True in Python, call all() builtin function and pass the tuple object as argument to it. all() returns True if all the items of Tuple are True, or else it returns False.

Python all() builtin function

Examples

In the following program, we take a tuple x, and check if all of its items are True using all() function.

Python Program

x = (True, True, True)
result = all(x)
print(result)

Output

True

Now, let us take a tuple with some of the items as False, and check using all() function if all the items are True.

Python Program

x = (True, True, False)
result = all(x)
print(result)

Output

False

Conclusion

In this Python Tutorial, we learned how to check if all items of a Tuple are True in Python, with examples.