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 e8b785f commit bce967eCopy full SHA for bce967e
pattern/1_1_2n.py
@@ -0,0 +1,34 @@
1
+n=int(input("enter no of rows: "))
2
+i=1
3
+sum=1
4
+k=0
5
+while i<=n:
6
+ j=i
7
+ if i%2==0:
8
+ sum=sum+i-1
9
+ k=sum
10
+ else:
11
+ sum=k+1
12
+ while j>0:
13
+ print(sum,' ',sep='',end="")
14
15
+ sum-=1
16
17
+ sum+=1
18
+ j-=1
19
+ print()
20
+ i+=1
21
+'''
22
+output:
23
+enter no of rows: 10
24
+1
25
+3 2
26
+4 5 6
27
+10 9 8 7
28
+11 12 13 14 15
29
+21 20 19 18 17 16
30
+22 23 24 25 26 27 28
31
+36 35 34 33 32 31 30 29
32
+37 38 39 40 41 42 43 44 45
33
+55 54 53 52 51 50 49 48 47 46
34
0 commit comments