Filter NumPy array
Filter the NumPy array using boolean indexing to keep all values greater than 75. Assign the resulting array to the variable filtered.
import numpy as np
data = np.array([10, 20, 30, 40, 50,
80, 12, 36, 91, 67,
45, 88, 23, 75, 19,
55, 70, 98, 32, 5,
83, 17, 60, 28, 42])
# filter array here...
filtered =
print(filtered)
# expected: [80 91 88 98 83]
Python
Setting up Python environment...
Output