Skip to content

Commit 57aa891

Browse files
Create 2_1_1n.py
1 parent dc07949 commit 57aa891

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

pattern/2_1_1n.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
=int(input("enter a number: "))
2+
i=1
3+
while i<=n:
4+
print(' '*(n-i),sep='',end="")
5+
j=1
6+
while j<=i:
7+
print(j,sep='',end="")
8+
j+=1
9+
j=i-1
10+
while j>=1:
11+
print(j,sep='',end="")
12+
j-=1
13+
i+=1
14+
print()
15+
'''
16+
output:
17+
enter a number: 6
18+
1
19+
121
20+
12321
21+
1234321
22+
123454321
23+
12345654321
24+
'''

0 commit comments

Comments
 (0)