用python在屏幕上输出一个杨辉三角

在屏幕上输出一个杨辉三角,代码如下

def yanghui():
    L = [1]
    while True:
        yield L
        L.append(0)
        L = [L[i - 1] + L[i] for i in range(len(L))]
a = yanghui()

for i in range(10)
     printf(next(a))
原文地址:https://www.cnblogs.com/qianxinxu/p/6517614.html