双层循环

#双层循环
def print_pic(n):
    for i in range(1,n+1):
        for j in range(1,n+1):
            if i==1 or i==n or j==1 or j==n:
                print("* ",end="")
            else:
                print("  ",end="")
        print()
while True:
    try:
        num=input()
        print_pic(int(num))
    except:
        break