import numpy as np
x = np.array([1, 0, 0, 0])
print("Original array:")
print(x)
print("Test whether any of the elements of a given array is non-zero:")
print(np.any(x))
x = np.array([0, 0, 0, 0])
print("Original array:")
print(x)
print("Test whether any of the elements of a given array is non-zero:")
print(np.any(x))
Sample Output:
Original array:
[1 0 0 0]
Test whether any of the elements of a given array is non-zero:
True
Original array:
[0 0 0 0]
Test whether any of the elements of a given array is non-zero:
False
Sample Output:
need an explanation for this answer? contact us directly to get an explanation for this answer