code: def dot(self, vector, theta=None):
          
          if theta is not None:
              return (self.magnitude() * vector.magnitude() *
                      math.degrees(math.cos(theta)))
          return (reduce(lambda x, y: x + y,
                  [x * vector.vector[i] for i, x in self.to_list()()]))
docs: Return the dot product of two vectors.
  
          If theta is given then the dot product is computed as
          v1*v1 = |v1||v2|cos(theta). Argument theta
          is measured in degrees.