打印实心矩形
#打印矩形
n=int (input())
for i in range (1,n+1):
for j in range (1,n+1):
print("*",end=" ")
print()
打印空心矩形
n=int (input())
for i in range (1,n+1):
for j in range (1,n+1):
if i==1 or j==1 or i==n or j==n:
print("*",end=" ")
else:
print(" ",end=" ")
print()
打印左下实心三角形
n=int (input())
for i in range (1,n+1):
for j in range (1,i+1):
print("*",end=" ")
print()
打印左下空心三角形
n=int (input())
for i in range (1,n+1):
for j in range (1,i+1):
if (i==n or i==j or j==1) :
print("*",end=" ")
else:
print(" ",end=" ")
print()
打印右下角实心三角形
n= int (input())
for i in range(n+1):
for j in range(0, (n+1) - i):
print(" ", end=" ")
for k in range((n+1)- i, n+1):
print("*", end=" ")
print("")
打印右下角空心三角形
n=int (input())
for i in range (1,n+1):
for j in range (1,n+1):
if i==n or j==n or (i+j-1==n):
print("*",end=" ")
else:
print(" ",end=" ")
print()
打印右上角实心三角形
n=int(input())
for i in range(n):
for j in range(0,i):
print(" ", end=" ")
for k in range(i,n):
print("*", end=" ")
print("")
打印右上角空心三角形
n=int (input())
for i in range (1,n+1):
for j in range (1,n+1):
if i==1 or j==n or i==j:
print("*",end=" ")
else:
print(" ",end=" ")
print()
打印左上角实心三角形
n=int (input())
for i in range (0,n+1):
for j in range (0,n-i):
print("*",end=" ")
print()
打印左上角空心三角形
n=int (input())
for i in range (0,n+1):
for j in range (0,n-i):
if (i==0) or (j==0) or i+j+1==n:
print("*",end=" ")
else:
print(" ",end=" ")
print()
打印正等边三角形
n=int(input())
for i in range(n+1):
for j in range(0, (n+1) - i):
print(end=" ")
for k in range((n+1) - i, (n+1)):
print("*", end=" ")
print("")
打印倒等边三角形
n=int(input())
for i in range(n):
for j in range(0, i):
print(end=" ")
for k in range(i, n):
print("*", end=" ")
print("")
打印正等边空心三角形
n=int(input())
for i in range(1, n*2):
if i == n:
print("*")
break
else:
print(" ", end="")
for j in range(n-1, 1, -1):
for i in range(1, n*2):
if i == j:
print("*", end="")
elif i == n*2 - j:
print("*")
break
else:
print(" ", end="")
for i in range(1, n*2):
if i % 2 != 0:
print("*", end="")
else:
print(" ", end="")