Discuss / Python / 交作业 .原来list可以+来运算

交作业 .原来list可以+来运算

Topic source

报三春晖

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

def yang(): L=[1] yield L while True: L=[1]+[L[a]+L[a+1] for a in range(0,len(L)-1)]+[1] yield L

n=0 for t in yang(): print(t) n=n+1 if n==10: break


  • 1

Reply