def dot_product(X, Y):
    """Computes dot product of two vectors u and v, each represented as a tuple
    or list of coordinates.  Assume the two vectors are the same length."""
    size = len(X)
    total = 0
    for i in range(size):
        total += X[i] * Y[i]
        #print X[i], Y[i]
        #print total
    return total