题解 | #箭形图案#
箭形图案
http://www.nowcoder.com/practice/a6d1081e0c9a42f19e42ed6cd91556c1
while True:
try:
num = int(input())
a, b = num * 2, num
for i in range(1, num * 2 + 2): # 应输出num*2+1行
if i <= num + 1: # 前半段+1
print(" " * a + "*" * i)
a -= 2
else: # 后半段
a += 2
print(" " * (a+2) + "*" * b) # 每行之间是两个空格的差值
b -= 1
except:
break