您需要适当的舍入:
def steps(start,end,n): if n<2: raise Exception("behaviour not defined for n<2") step = (end-start)/float(n-1) return [int(round(start+x*step)) for x in range(n)]
欢迎分享,转载请注明来源:内存溢出
您需要适当的舍入:
def steps(start,end,n): if n<2: raise Exception("behaviour not defined for n<2") step = (end-start)/float(n-1) return [int(round(start+x*step)) for x in range(n)]
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)