I would like to write a function to compute the dot product of two vectors without using extra libraries. Following is an attempt that I made. Can someone point out the flaws in
def dot(v1,v2): if len(v1) != len(v2): raise ValueError return sum(i1*i2 for i1,i2 in zip(v1,v2))