I believe the input should be a numpy array of floats which has a shape attribute
One should read
def rosen_explicit_loop(x):
s = 0.
n = x.shape[0]
for i in range(0, n - 1):
s += 100. * (x[i + 1] - x[i] ** 2.) ** 2. + (1 - x[i]) ** 2
return s
(edited) n = x.shape[0]