在屏幕上输出一个杨辉三角,代码如下
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))