我也来交作业,是在原列表里修改
Topic sourcedef yor(max): i,n,L,L1,L2 = 0,0,[1],[1],[1,1] if max == 1: yield L1 elif max ==2: yield L2 else: yield L1 yield L2 n = n + 2 L0 = L2 while n < (max-1): for x in range((len(L0)-1)): L.append(L0[i]+L0[i+1]) i =i+1 L.append(1) yield L L0 = L L = [1] n = n+1 i = 0 return 'ok'
- 1
GUK0