题目:
打印出如下图案(菱形):
代码:
for row_num in range(1, 5):
character = '*'*(2*row_num-1)
print(character.center(13, ' '))
for row_num in [3, 2, 1]:
character = '*'*(2*row_num-1)
print(character.center(13, ' '))
运行结果:
题目:
代码:
for row_num in range(1, 5):
character = '*'*(2*row_num-1)
print(character.center(13, ' '))
for row_num in [3, 2, 1]:
character = '*'*(2*row_num-1)
print(character.center(13, ' '))
运行结果: