python杨辉三角

输入n,输出n行杨辉三角

row_one=[1]
row_two=[1]
n=int(input())
for x in row_one:
    print(x)
for i in range(n-1):
    c=0
    for j in range(len(row_one)-1):
        if(len(row_one)>1):
            row_two.append((row_one[c]+row_one[c+1]))
        elif(len(row_one)==1):
            row_two.append(1)
        c+=1
    row_two.append(1)
    row_one=row_two
    for x in row_two:
        print(x),
    print("\t")
    row_two=[1]

    原文作者:杨辉三角问题
    原文地址: https://blog.csdn.net/grayfox_83/article/details/79015849
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞