Module 10

NumPy arrays

Creating and using arrays.

Arrays

A NumPy array is like a list, but designed for mathematical operations. You can perform operations on the entire array at once.

Python
import numpy as np
arr = np.array([10, 20, 30])
print(arr.mean())
print(arr.sum())
20.0 60
Your task

Array operations

  • Compute mean and sum of a NumPy array.