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