In this python numpy program, we will print every element of an array using NumPy.
Steps to solve the program
- Import the numpy library as np.
- Create an array using np.array().
- Use for loop with np.nditer() to print every element of the given array.
- Print the output.
import numpy as np
x = np.array([[4,8,0],[2,0,6]])
for ele in np.nditer(x):
print(ele,end=' ')
Output :
4 8 0 2 0 6