Iterating involves accessing elements one by one.
When working with multi-dimensional arrays in NumPy, we can use a basic Python for loop for this purpose.
If we iterate over a 1-D array, it will sequentially access each element.
Iterate through the elements of the following 1-D array:
import numpy as np arr = np.array([1, 2, 3]) for x in arr: print(x) |