1 ''' 2 闪电 3 4 * 5 ** 6 *** 7 ******* 8 *** 9 ** 10 * 11 ''' 12 13 n = 7 14 e = -(n//2) 15 for i in range(e,1-e):# -3 3 16 if i < 0: 17 print(abs(i) * ' ' + (4 - abs(i)) * '*') 18 elif i > 0: 19 print(3 * ' ' + (4 - i) * '*') 20 else: 21 print(7 * '*') 22 23 24 for i in range(e, 1-e): 25 # 用了两层 三元运算符 26 print(abs(i) * ' ' + (4 - abs(i)) * '*') if i < 0 else ( print(3 * ' ' +(4 - i) * '*') if i > 0 else print( 7 * '*'))