#中空等腰三角形 def triangle1(num): star = 1 for i in range(num): if i == 0 or i == num-1: star_ = format("*"*star,"^"+str(num*2-1)) else: star_ = format("*"+" "*(star-2)+"*","^"+str(num*2-1)) star += 2 print(star_) triangle1(5) # * # * * # * * # * * # *********