*
**
***
****
*****
******
*******
********
*********
*
***
*****
*******
*********
***********
*************
***************
*****************
*
***
*****
*******
*********
*******
*****
***
*
Nums = 9 # 三角形
for i in range(1, Nums + 1):
for j in range(1, i + 1):
print('*', end='')
print()
# 金字塔
for i in range(1, Nums + 1):
for j in range(1, Nums - i + 1):
print(end=' ')
for j in range(1, 2 * i):
print('*', end='')
print()
# 菱形 Nums=9
k = Nums // 2 + 1
for i in range(1, k + 1):
for j in range(1, k - i + 1):
print(end=' ')
for j in range(1, 2 * i):
print('*', end='')
print()
for i in range(k - 1, 0, -1):
for j in range(1, k - i + 1):
print(end=' ')
for j in range(1, 2 * i):
print('*', end='')
print()
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)