格式如图:

 代码实现:

def triangle(row):
    for i in range(1,row+1):
        for x in range(i):
            print('*',end='')
        print()
    for i in range(1,row+1):
        for x in range(row-i):
            print(' ', end='')
        for x in range(i):
            print('*', end='')
        print()
    for i in range(1, row + 1):
        a=row-i
        for x in range(a):
            print(' ',end='')
        for x in range(2*i-1):
            print('*', end='')
        print()     
row = int(input())
triangle(row)