Update multiple NumPy array elements
Replace all elements in the array with a value smaller than 3 with 99.
import numpy as np
a = np.array([
[3, 1, 7],
[4, 9, 2],
[12, 3, 1],
[12, 11, 8]
])
# update values here...
print(a)
# expected: [[3 99 7][4 9 99][12 3 99][12 11 8]]
Python
Setting up Python environment...
Output