def interval(a,b,n):
dx = float(b-a)/(n+1)
cnt = 1
points = [a]
xj = a
while cnt <= n+1:
xj += dx
points.append(xj)
cnt+=1
return points
答案 0 :(得分:0)
替换您的功能,如下所示: -
def interval(a,b,n):
dx = float(b-a)/(n+1)
points = [a]
xj = a
points.extend([xj + (i * dx) for i in xrange(1, n+2)])
return points