random_walk.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:MIT-CS-lectures 作者: William-Python-King 项目源码 文件源码
def ansQuest(maxTime,numTrials):
    means=[]
    distLists=performSim(maxTime,numTrials)
    for t in range(maxTime+1):
        tot=0.0
        for distL  in  distLists:
            tot+=distL[t]
        means.append(tot/len(distL))
    pylab.figure()
    pylab.plot(means)
    pylab.xlabel('distance')
    pylab.ylabel('time')
    pylab.title('Average Distance  vs. Time ('+str(len(distLists))+'trials)')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号