BC112 空心三角形图案

思路:

step1:i + j == n+1 or j == n or i == n时打印⭐ ;

代码如下:

while True:
    try:
        n = int(input())
        i = 1
        while i <= n:
            j = n
            while j >= 1:
                if i + j == n+1:
                    print('* ',end='')
                elif j == n or i == n:
                    print('* ',end='')
                else:
                    print('  ',end='')
                j -= 1
            print()
            i += 1
    except:
        break