0

I'm trying to write a function to return the sum of two vectors. However, my function returns the memory instead of value.

def vector_add2(vector1, vector2):
    return map(lambda x,y: x+y, vector1, vector2)

I also wrote another function to compute the dot product.

def dot_product2(vector1, vector2):
    return sum(map(lambda x, y: x*y, vector1, vector2))

This function works well. Is the map function problem?

Ryan Zhao
  • 105
  • 3
  • 7

0 Answers0