Q:

Write a NumPy program to create a 3X4 array using and iterate over it

0

Write a NumPy program to create a 3X4 array using and iterate over it

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import numpy as np
a = np.arange(10,22).reshape((3, 4))
print("Original array:")
print(a)
print("Each element of the array is:")
for x in np.nditer(a):
  print(x,end=" ")

Sample Output:

Original array:
[[10 11 12 13]
 [14 15 16 17]
 [18 19 20 21]]
Each element of the array is:
10 11 12 13 14 15 16 17 18 19 20 21

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now