Mean of a Vector

easynumpy_basics

Implement vector_mean(x).

Return the arithmetic mean (average) of the 1D array x. (numpy-100 motivates this by creating a random vector of size 30 and finding its mean — here you just compute the mean of the given vector.) No for/while loops.

Constraints
  • no for/while loops

Your solution

Edit vector_mean 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

a.mean() averages all elements (it's the sum divided by the count).