def main():
num = int(input('Number of rows: '))
yh = [[]] * num
for row in range(len(yh)):
yh[row] = [None] * (row + 1)
for col in range(len(yh[row])):
if col == 0 or col == row:
yh[row][col] = 1#两边的1
else:
yh[row][col] = yh[row - 1][col] + yh[row - 1][col - 1]#逻辑
print(yh[row][col],end='\t')#end='\t'表示不换行
print()#换行
if __name__ == '__main__':
main()
yh为num层空列表,len(yh)=num