打印等腰三角形 ''' * 1 3 1 *** 2 2 3 ***** 3 1 5 ******* 4 0 7 ''' a = int(input("输入行数:")) for i in range(0,a+1): #空格数 space = a - i for j in range(space,0,-1): print(" ",end="") #星数 star = 2 * i - 1 for k in rang
打印等腰三角形
'''* 1 3 1
*** 2 2 3
***** 3 1 5
******* 4 0 7
'''
a = int(input("输入行数:"))
for i in range(0,a+1):
#空格数
space = a - i
for j in range(space,0,-1):
print(" ",end="")
#星数
star = 2 * i - 1
for k in range(0,star):
print("*",end="")
#换行
print()