NumPy - Array Operations
Identify the error in this numpy comparison code:
import numpy as np arr = np.array([1, 2, 3]) result = arr = 2 print(result)
import numpy as np arr = np.array([1, 2, 3]) result = arr = 2 print(result)
arr = 2 which assigns 2 to arr, not compares. Comparison needs ==.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions