All problems
L2 Vector Norm
Problem
Compute the L2 (Euclidean) norm of a vector v: sqrt(sum(v[i]^2)).
Test cases
case 1
in: [[3,4]]
expected: 5
case 2
in: [[1,0,0]]
expected: 1
case 3
in: [[1,1,1,1]]
expected: 2
case 4
in: [[0,0,0]]
expected: 0
Starter codePython
def l2_norm(v):
# Your code here
pass4 test cases · run your code against them in the editor