w3resource logo

:

Python Exercises

Python NumPy: Print all the values of an array

Python NumPy: Array Object Exercise-97 with Solution

Write a Python program to print all the values of an array.

Sample Solution:-

Python Code:

import numpy as np
np.set_printoptions(threshold=np.nan)
x = np.zeros((4, 4))
print(x)

Sample Output:

[[ 0.  0.  0.  0.]                                                     
 [ 0.  0.  0.  0.]                                                     
 [ 0.  0.  0.  0.]                                                     
 [ 0.  0.  0.  0.]]

Python Code Editor:

Improve this sample solution and post your code through Disqus