9951 explained code solutions for 126 technologies


python-numpyCheck if any array element is True


import numpy as np

a = np.array([False, True, False])

has_true = a.any()ctrl + c
import numpy as np

load Numpy module for Python

np.array

declare Numpy array

.any()

will return True if any array of a given element is True