a = "ABCDEFGHIJKLMNOPQRSTUVWXY"
rows = int(input("请输入行数"))
c = rows//2+1
if rows>3 and rows%3!=0:
for i in range(c+1):
b = ""
for j in range(0,i):
b += a[j]
for j in range(i-2,-1,-1):
b += a[j]
for j in range(c-i):
print(" ",end=‘‘)
print(b)
for i in range(rows-c,-1,-1):
b = ""
for j in range(0,i):
b += a[j]
for j in range(i-2,-1,-1):
b += a[j]
for j in range(rows-c-i+1):
print(" ",end=‘‘)
print(b)
else:
print("请输入一个大于3且除以3不等于0的数")
原文:https://www.cnblogs.com/lize666/p/14765672.html