Task

Write a program to find the sum of squares of a numeric vector.

The program should work on a zero-length vector (with an answer of   0).



Related task

   Mean


def sum_squares(vector)
        if len(vector) = 0
                return 0
        end
 
        sum = 0
        for n in vector
                sum += n ^ 2
        end
        return sum
end
 
println sum_squares({})
println sum_squares({1, 2, 3, 4, 5})
println sum_squares({10, 3456, 2, 6})