File tree 1 file changed +51
-0
lines changed
1 file changed +51
-0
lines changed Original file line number Diff line number Diff line change
1
+ '''
2
+ Problem statement
3
+ Print the following pattern for the given number of rows.
4
+
5
+ Pattern for N = 4
6
+
7
+
8
+
9
+ The dots represent spaces.
10
+
11
+
12
+
13
+
14
+ Detailed explanation ( Input/output format, Notes, Images )
15
+ Constraints :
16
+ 0 <= N <= 50
17
+ Sample Input 1:
18
+ 5
19
+ Sample Output 1:
20
+ 1
21
+ 232
22
+ 34543
23
+ 4567654
24
+ 567898765
25
+ Sample Input 2:
26
+ 4
27
+ Sample Output 2:
28
+ 1
29
+ 232
30
+ 34543
31
+ 4567654
32
+ '''
33
+
34
+ from math import *
35
+ from collections import *
36
+ from sys import *
37
+ from os import *
38
+
39
+ ## Read input as specified in the question.
40
+ n = int (input ())
41
+ ## Print output as specified in the question.
42
+
43
+ for i in range (1 ,n + 1 ):
44
+ for s in range (n - i ):
45
+ print (" " ,end = "" )
46
+ for j in range (i ,2 * i ):
47
+ print (j , end = "" )
48
+ for k in range (2 * i - 2 ,i - 1 ,- 1 ):
49
+ print (k ,end = "" )
50
+ print ()
51
+
You can’t perform that action at this time.
0 commit comments