Memory Size of an Array

easynumpy_basics

Implement memory_size(a).

Return the total number of bytes the array a occupies in memory — the number of elements times the number of bytes per element. Compute it from a.size and a.itemsize (the nbytes shortcut is not allowed).

Constraints
  • no nbytes

Your solution

Edit memory_size and run the real pytest suite in your browser — no install required. Your code is saved locally.

⌘/Ctrl + ↵

Loading the Python runtime (first run only)…

Hints

Hint 1

An array holds a.size elements, each a.itemsize bytes — multiply them.