BC111 空心正方形图案

思路:

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

代码如下:

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