We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 413c1dc commit aadbbbdCopy full SHA for aadbbbd
pattern/1_2_1n.py
@@ -0,0 +1,35 @@
1
+n=int(input('enter a number'))
2
+for i in range(1,n+1):
3
+ for j in range(0,n+1-i):
4
+ if i<=(n//2+n%2):
5
+ print(i%(n//2+n%2+1),end='')
6
+ else:
7
+ if n%2!=0:
8
+ print(n//2+n%2-i%(n//2+n%2),end='')
9
10
+ print(n//2-i%(n//2+1),end='')
11
+ print()
12
+'''
13
+output:
14
+enter a number8
15
+11111111
16
+2222222
17
+333333
18
+44444
19
+4444
20
+333
21
+22
22
+1
23
24
25
26
+111111111
27
+22222222
28
+3333333
29
+444444
30
+55555
31
32
33
34
35
0 commit comments