CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
jackfrued

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: jackfrued/Python-100-Days
Path: blob/master/Day01-15/code/Day04/for6.py
Views: 729
1
"""
2
打印各种三角形图案
3
4
*
5
**
6
***
7
****
8
*****
9
10
*
11
**
12
***
13
****
14
*****
15
16
*
17
***
18
*****
19
*******
20
*********
21
22
Version: 0.1
23
Author: 骆昊
24
Date: 2018-03-01
25
"""
26
27
row = int(input('请输入行数: '))
28
for i in range(row):
29
for _ in range(i + 1):
30
print('*', end='')
31
print()
32
33
for i in range(row):
34
for j in range(row):
35
if j < row - i - 1:
36
print(' ', end='')
37
else:
38
print('*', end='')
39
print()
40
41
for i in range(row):
42
for _ in range(row - i - 1):
43
print(' ', end='')
44
for _ in range(2 * i + 1):
45
print('*', end='')
46
print()
47
48