Python Programming - Arrays - Discussion

Discussion Forum : Arrays - General Questions (Q.No. 36)
36.
How do you check if all elements in a NumPy array arr are non-zero?
np.check_nonzero(arr)
np.nonzero(arr)
np.all_nonzero(arr)
np.all(arr != 0)
Answer: Option
Explanation:
The code np.all(arr != 0) checks if all elements in the array are non-zero.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.