用户:
五阶段查看:0 回复:0 评论:0 创建时间:2022-03-13T17:16:31
【作品展示】

【作品介绍】
哈哈哈哈
【作品源代码】
'''杨辉三角金字塔v3.0-工程包'''
res = []
for x in range(9):
if (x == 0):
res.append([1])
elif (x == 1):
res.append([1, 1])
else:
l = []
for y in range(len(res[(x - 1)])):
if (y == 0):
l.append(1)
else:
l.append((res[(x - 1)][y] + res[(x - 1)][(y - 1)]))
l.append(1)
res.append(l)
# 使用center()函数调整输出造型
for i in res:
a = ""
for j in i:
a += (str(j) + " ")
print(a.center(60))
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn