Skip to content

Commit 9312dcb

Browse files
Create 3_1_1.py
1 parent 40a7cd0 commit 9312dcb

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

pattern/3_1_1.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
=int(input("enter a number: "))
2+
for i in range(1,n+1):
3+
print(' '*(i-1),i,sep='',end="")
4+
print(' '*(2*(n-i)-1),i if i!=n else "",sep='')
5+
#print(' '*(2*(n-i)-1),'*',sep='') if i!=n else print()
6+
for i in range(n-1,0,-1):
7+
print(' '*(i-1),i,sep='',end="")
8+
print(' '*(2*(n-i)-1),i,sep='')
9+
'''
10+
output:
11+
enter a number: 6
12+
1 1
13+
2 2
14+
3 3
15+
4 4
16+
5 5
17+
6
18+
5 5
19+
4 4
20+
3 3
21+
2 2
22+
1 1
23+
'''

0 commit comments

Comments
 (0)