Test whether a number is scalar or not using NumPy.

In this python numpy program, we will test whether a number is scalar or not using NumPy.

Steps to solve the program
  1. Import the numpy library as np.
  2. Create an array using np.array().
  3. Test whether a number is scalar or not using np.isscalar().
  4. Print the output.
				
					import numpy as np
x = 8.9
print(np.isscalar(x))

y = [8.9]
print(np.isscalar(y))
				
			

Output: 

				
					True
False
				
			

test element-wise for real numbers of a given array.

test whether two arrays are element-wise equal.

Leave a Comment