w3resource logo


Python Exercises

Python NumPy: Find the memory size of a NumPy array

Python NumPy: Array Object Exercise-33 with Solution

Write a Python program to find the memory size of a NumPy array.

Sample Solution:-

Python Code:

import numpy as np
n = np.zeros((4,4))
print("%d bytes" % (n.size * n.itemsize))

Sample Output:

128 bytes 

Python Code Editor:

Improve this sample solution and post your code through Disqus