Skip to content

Commit 35cfc1f

Browse files
authored
Merge pull request openAOD#914 from Mahak008/main
Numeric Patterns
2 parents 90bf5f5 + f5f7178 commit 35cfc1f

40 files changed

+1038
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
height = int(input())
2+
3+
for i in range(1,height+1):
4+
5+
for j in range(1,height*2+1):
6+
if(j == height-i+1 or j == height+i-1):
7+
c = chr(i+64)
8+
print(c,end=" ")
9+
10+
else:
11+
print(end=" ")
12+
13+
print()
14+
15+
# Sample Input :- 5
16+
# Output :-
17+
# A
18+
# B B
19+
# C C
20+
# D D
21+
# E E
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
height = int(input())
2+
3+
for i in range(1,height+1):
4+
5+
for j in range(1,height*2+1):
6+
if(j == height-i+1 or j == height+i-1):
7+
c = chr(height-i+65)
8+
print(c,end=" ")
9+
10+
else:
11+
print(end=" ")
12+
13+
print()
14+
15+
# Sample Input :- 5
16+
# Output :-
17+
# E
18+
# D D
19+
# C C
20+
# B B
21+
# A A
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
height = int(input())
2+
3+
for i in range(1,height+1):
4+
5+
for j in range(1,height*2+1):
6+
if(j == height-i+1 or j == height+i-1):
7+
c = chr(j+64)
8+
print(c,end=" ")
9+
10+
else:
11+
print(end=" ")
12+
13+
print()
14+
15+
# Sample Input :- 5
16+
# Output :-
17+
# E
18+
# D F
19+
# C G
20+
# B H
21+
# A I
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
height = int(input())
2+
3+
for i in range(1,height+1):
4+
5+
for j in range(1,height*2+1):
6+
if(j == i or j == 2*height-i):
7+
c = chr(i+64)
8+
print(c,end=" ")
9+
10+
else:
11+
print(end=" ")
12+
13+
print()
14+
15+
# Sample Input :- 5
16+
# Output :-
17+
# A A
18+
# B B
19+
# C C
20+
# D D
21+
# E
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
height = int(input())
2+
3+
for i in range(1,height+1):
4+
5+
for j in range(1,height*2+1):
6+
if(j == i or j == 2*height-i):
7+
c = chr(height-i+65)
8+
print(c,end=" ")
9+
10+
else:
11+
print(end=" ")
12+
13+
print()
14+
15+
# Sample Input :- 5
16+
# Output :-
17+
# E E
18+
# D D
19+
# C C
20+
# B B
21+
# A
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
height = int(input())
2+
3+
for i in range(1,height+1):
4+
5+
for j in range(1,height*2+1):
6+
if(j == i or j == 2*height-i):
7+
c = chr(j+64)
8+
print(c,end=" ")
9+
10+
else:
11+
print(end=" ")
12+
13+
print()
14+
15+
# Sample Input :- 5
16+
# Output :-
17+
# A I
18+
# B H
19+
# C G
20+
# D F
21+
# E
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
height = int(input())
2+
x = 1
3+
4+
for i in range(1,height+1):
5+
6+
for j in range(1,x+1):
7+
if(j == x):
8+
c = chr(i+64)
9+
print(c,end=" ")
10+
11+
else:
12+
print(end=" ")
13+
14+
if(i <= height//2):
15+
x += 1
16+
17+
else:
18+
x -= 1
19+
20+
print()
21+
22+
# Sample Input :- 5
23+
# Output :-
24+
# A
25+
# B
26+
# C
27+
# D
28+
# E
29+
# F
30+
# G
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
height = int(input())
2+
x = 1
3+
4+
for i in range(1,height+1):
5+
6+
for j in range(1,x+1):
7+
if(j == x):
8+
c = chr(j+64)
9+
print(c,end=" ")
10+
11+
else:
12+
print(end=" ")
13+
14+
if(i <= height//2):
15+
x += 1
16+
17+
else:
18+
x -= 1
19+
20+
print()
21+
22+
# Sample Input :- 5
23+
# Output :-
24+
# A
25+
# B
26+
# C
27+
# D
28+
# C
29+
# B
30+
# A
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
height = int(input())
2+
x = height//2+1
3+
4+
for i in range(1,height+1):
5+
6+
for j in range(1,x+1):
7+
if(j == x):
8+
c = chr(i+64)
9+
print(c,end=" ")
10+
11+
else:
12+
print(end=" ")
13+
14+
if(i <= height//2):
15+
x -= 1
16+
17+
else:
18+
x += 1
19+
20+
print()
21+
22+
# Sample Input :- 5
23+
# Output :-
24+
# A
25+
# B
26+
# C
27+
# D
28+
# E
29+
# F
30+
# G
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
height = int(input())
2+
3+
for i in range(1,height):
4+
5+
for j in range(1,i+1):
6+
c = chr(height-j+64)
7+
print(c,end=" ")
8+
9+
print()
10+
11+
12+
for i in range(height-1,0,-1):
13+
14+
for j in range(height-1,height-i,-1):
15+
c = chr(j+64)
16+
print(c,end=" ")
17+
18+
print()
19+
20+
# Sample Input :- 5
21+
# Output :-
22+
# D
23+
# D C
24+
# D C B
25+
# D C B A
26+
# D C B
27+
# D C
28+
# D

0 commit comments

Comments
 (0)