for i in range(1,10,2): #正序输出 b = '*' * i b=b.center(9) print(b) #for j in range(7,0,-2): # c = '*' * j # c = c.center(9) # print(c) for j in reversed(range(1,8,2)): #反序输出 c = '*' * j c = c.center(9) print(c) #for j in range(1,8,2)[::-1]: # c = '*' * j # c = c.center(9) # print(c)