Discuss / Python / 交作业

交作业

Topic source

不忈嫑脸

#1 Created at ... [Delete] [Delete and Lock User]

#今天的作业有点东西,思考很长时间才看懂别人写的

#L=[0]+[1]+[0]=[0,1,0]

#for循环,range()函数,len()函数

l = [1]

    while True:

        yield l

        l = [0]+l+[0]

        l = [l[i]+l[i+1] for i in range(len(l)-1)]


  • 1

Reply