Test whether none of the elements of a given array is zero using NumPy.

In this python numpy program, we will test whether none of the elements of a given array is zero using Numpy.

Steps to solve the program
  1. Import the numpy library as np.
  2. Create an array using np.array().
  3. Test whether none of the elements of a given array is zero using np.all().
  4. Print the output.
				
					import numpy as np
x = np.array([6,8,3,5])

print(np.all(x))
				
			

Output :

				
					True
				
			

get the NumPy version

test a given array element-wise is finite or not.

Leave a Comment