Python – Check if Any Item of Tuple is True
To check if any item of a Tuple is True in Python, call any() builtin function and pass the tuple object as argument to it. any() returns True if any the item of Tuple is True, or else it returns False.
In the following program, we take a tuple
x, and check if at least one its items is True using any() function.
x = (False, True, True) result = any(x) print(result)Try Online
Now, let us take a tuple with all of its items as False, and check using any() function if any of the item is True.
x = (False, False, False) result = any(x) print(result)Try Online
In this Python Tutorial, we learned how to check if any of the item in Tuple is True in Python, with examples.