norm of vector in python code example Example 1: p-norm of a vector python np.linalg.norm(x, 2) Example 2: p-norm of a vector python np.sqrt(np.sum(np.power(x, 2)))