Run
import numpy as np # 2D array a = (np.arange(8)*2).reshape(2,4) # Print array print("The array\n",a) print("\nIterating over all the elemnets of array") # Iterate over elements of the array for x in np.nditer(a): print(x, end=' ')
Output