打印等腰三角形

2023-01-31 00:01:03 打印 角形
   *
***
*****
*******
for i in range(1,5):
    for k in range(0,5-i):
        print(" ",end='')
    for j in range(1,2*i):
        print("*",end='')
    print()
   *
* *
* *
*******
for i in range(1,5):
    for k in range(5-i):
        print(' ',end='')
    for j in range(1,2*i):
        if i == 1 or i == 4 or j == 1 or j == 2*i - 1:
            print('*',end='')
        else:
            print(' ',end='')
    print()

 

相关文章