Closed julietwk closed 7 years ago
vector_sum
is supposed to take a list of "vectors" (that is, a list of lists) and vector_add
them together. you're giving it a vector. it should work if you did
vector_sum([[1, 2, 3, 4]]) # a list with one 4-vector
or
vector_sum([[1], [2], [3], [4]]) # a list of four 1-vectors
Amazing!! Thanks a lot Joel! :)
Hey, working through some of the examples and it seems the below code is not set up properly even though vector_add has been defined:
def vector_sum2(vectors): return reduce(vector_add, vectors)
When I try and run the below in the ipython console I get an error saying: "zip argument #1 must support iteration"
vector_sum([1,2,3,4])
Please could you verify that the code is correct/incorrect?
Many thanks!