Python简单实现杨辉三角
n=input("请输入要打印的行数")
n=int(n)
for x in range(0,n+1):
p=1
print(''.rjust(n-x),end="")
for y in range(0,x+1):
print(p,end=" ")
p = p * (x-y)/(y+1)
p=int(p)
print("\n")
n=input("请输入要打印的行数")
n=int(n)
for x in range(0,n+1):
p=1
print(''.rjust(n-x),end="")
for y in range(0,x+1):
print(p,end=" ")
p = p * (x-y)/(y+1)
p=int(p)
print("\n")