layer = int(input("请输入你要打印的行数:"))
for i in range(1,layer+1):
#计算空格的个数
spce_num = layer - i
for j in range(0,spce_num):
print(" ",end="")
#计算*个数
star_num = 2 * i - 1
for j in range(0,star_num):
print("*", end="")
print("")
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)