-- coding: utf-8 -- def triangles(): L=[1] while 1: #即while True: 一直循环生成无限临时数据 yield L L = [L[i-1] + L[i ] for i in range(1,len(L))] L.insert(0, 1) L.append(1)
n = 0 for x in triangles(): print(str.center(str(x),50," ")) n += 1 if n == 10: break
n+=1这一行是什么意思啊
n = n+1
Sign in to make a reply
花泽的类
-- coding: utf-8 -- def triangles(): L=[1] while 1: #即while True: 一直循环生成无限临时数据 yield L L = [L[i-1] + L[i ] for i in range(1,len(L))]
L.insert(0, 1)
L.append(1)
n = 0 for x in triangles(): print(str.center(str(x),50," ")) n += 1 if n == 10: break