Discuss / Python / 想了半天,其实不该想的太复杂

想了半天,其实不该想的太复杂

Topic source

lemonjoke

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

def tri(): L=[1] yield L while True: L=[1]+[L[x]+L[x+1] for x in range(len(L)-1)]+[1] yield L

n=0 for L in tri(): print(L) n=n+1 if n==10: break


  • 1

Reply