【发布时间】:2014-01-20 03:11:10
【问题描述】:
我一直在试图弄清楚如何将从 while 循环中获得的数字关联到一个数组中。好久都想不通了。
我想使用循环将获得的 Vmax 值(在 500 到 600 之间以 20 为增量)放入一个数组中,然后再获得一个与 vmax 数组相关的另一个数组。
import pylab
print "vMax | Time to Land"
print "================================================================================="
sumx = 0
Vmax=500
while Vmax<=600:
if Vmax>=500 and Vmax<=600:
avesp = pylab.zeros (6,float)
avesp = ((Vmax + mins)/2.0) #creating formula for average speed
t = pylab.zeros(6,float)
t = dT / avesp #formula for time taken
print Vmax
sumx = sumx + Vmax
Vmax = Vmax + 20
vmax = pylab.array([Vmax],int)
【问题讨论】:
-
是
vmax = pylab.array([Vmax],int)错字还是在未显示的代码中声明?
标签: python arrays loops matplotlib while-loop