题解 | #金字塔图案#
金字塔图案
http://www.nowcoder.com/practice/d84e8339f9444bb6b29bd3f227c8e538
BC103 金字塔图案
思路:
step1:注意空格和⭐的规律;
代码如下:
while True:
try:
n = int(input())
i = 1
while i <= n:
j = 1
while j <= n:
if i+j > n:
print('* ',end='')
else:
print(' ',end='')
j += 1
print()
i += 1
except:
break