rows = int(input("请输入行数(奇数):")) i = 1 while i<=rows: if i<=rows/2+1: j = rows // 2 x = 1 while j>=i: print(" ",end="") j-=1 while x<= 2*(i-1)+1: print("*",end="") x+=1 print("") else: z = 1 y = (rows-i+1)*2-1 while z <= i-(rows//2+1): print(" ",end="") z+=1 while y > 0: print("*",end="") y-=1 print() i+=1
我只知道通过判断打印上部分和下部分,没搞明白空格那些是什么计算思路,求大神帮忙理一下思路。
慕桂英4516509
慕桂英4516509
慕桂英4516509