# 05.20 a
integer_num = 7
for i in range(1, integer_num + 1):
for j in range(1,i+1):
print(j,end=" ")
print()
#05.20.b
integer_num = 7
for i in range(integer_num, 0, -1):
for j in range(1, i + 1):
print(j, end=" ")
print()
# 05.20.c
integer_num = 8
mup_num = 2
for i in range(1, integer_num):
for k in range(integer_num - i, 0, -1):
print(k * "", end=" ")
for j in range(i, 0, -1):
print(j, end=" ")
print()
# 5.20.d 2024.4.2 done this !
integer_num = 7
for j in range(integer_num + 1, 1, -1):
print((abs(j-9))*" ", end="")
for k in range(1, j):
print(k, end=" ")
print()
本站资源均来自互联网,仅供研究学习,禁止违法使用和商用,产生法律纠纷本站概不负责!如果侵犯了您的权益请与我们联系!
转载请注明出处: 免费源码网-免费的源码资源网站 » 《python语言程序设计》2018版第5章第20题(使用循环显示四种模式)
发表评论 取消回复