三角形图形
# triangle.py def triangle(n: int) -> None: row = n for i in range(row-1): # asterisk & new line print('*' * (i+1), end='') # whitespace print(' ' * (n-i-1), end='') # whitespace print(' ' * (row-i-1), end='') # asterisk & new line print('*' * (i+1)) for i in range(row): # asterisk print('*' * (row - i), end='') # whitespace print(' ' * (i), end='') # whitespace print(' ' * (i), end='') # asterisk & new line print('*' * (row - i)) if __name__ == '__main__': triangle(20)