About vectorisation

def error(x,y,theta):
error=0.0
y_ = hypothesis(x,theta)
e=np.sum((y-y_)**2)

Sir/Ma’am In this function y_=hypothesis(x,theta) ,will be called only once so it’s value will be constant then y_ is varying in e=np.sum((y-y_)**2)