python check if all list elements are true code example
Example 1: check all elements in list are false python
>>> data = [False, False, False]
>>> not any(data)
True
Example 2: check all true python
>>> items = [[1, 2, 0], [1, 2, 0], [1, 2, 0]]
>>> all(flag == 0 for (_, _, flag) in items)
True
>>> items = [[1, 2, 0], [1, 2, 1], [1, 2, 0]]
>>> all(flag == 0 for (_, _, flag) in items)
False