Q:

Write a NumPy program to test whether specified values are present in an array

0

Write a NumPy program to test whether specified values are present in an array.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import numpy as np
x = np.array([[1.12, 2.0, 3.45], [2.33, 5.12, 6.0]], float) 
print("Original array:")
print(x)
print(2 in x)
print(0 in x)
print(6 in x)
print(2.3 in x)
print(5.12 in x)

Sample Output:

Original array:                                                        
[[ 1.12  2.    3.45]                                                   
 [ 2.33  5.12  6.  ]]                                                  
True                                                                   
False                                                                  
True                                                                   
False                                                                  
True

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now