Skip to content

Commit 59432ae

Browse files
authored
Merge pull request openAOD#915 from Mahak008/main
Pyramid Patterns
2 parents 35cfc1f + 6b865f7 commit 59432ae

10 files changed

+260
-0
lines changed

Pyramid Patterns/pyramidpattern55.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
height = int(input())
2+
3+
for i in range(1,height):
4+
5+
for j in range(height-i,1,-1):
6+
print(end=" ")
7+
8+
for j in range(height-i-1,height-1):
9+
print(j,end=" ")
10+
11+
print()
12+
13+
for i in range(1,height):
14+
15+
for j in range(1,i+1):
16+
print(end=" ")
17+
18+
for j in range(height-i,1,-1):
19+
print(height-j,end=" ")
20+
21+
print()
22+
23+
# Sample Input :- 5
24+
# Output :-
25+
# 3
26+
# 2 3
27+
# 1 2 3
28+
# 0 1 2 3
29+
# 1 2 3
30+
# 2 3
31+
# 3

Pyramid Patterns/pyramidpattern66.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
height = int(input())
2+
3+
for i in range(0,height+1):
4+
5+
for j in range(0,i):
6+
print(end=" ")
7+
8+
for j in range(height,i,-1):
9+
10+
if(i%2 == 0):
11+
print(height-i,end=" ")
12+
13+
else:
14+
print("*",end=" ")
15+
16+
print()
17+
18+
# Sample Input :- 5
19+
# Output :-
20+
# 5 5 5 5 5
21+
# * * * *
22+
# 3 3 3
23+
# * *
24+
# 1
25+

Pyramid Patterns/pyramidpattern67.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
height = int(input())
2+
3+
for i in range(0,height+1):
4+
5+
for j in range(0,height-i+1):
6+
print(end=" ")
7+
8+
for j in range(0,i):
9+
10+
if(i%2 == 0):
11+
print(i,end=" ")
12+
13+
else:
14+
c = chr(i+64)
15+
print(c,end=" ")
16+
17+
print()
18+
19+
# Sample Input :- 5
20+
# Output :-
21+
# A
22+
# 2 2
23+
# C C C
24+
# 4 4 4 4
25+
# E E E E E

Pyramid Patterns/pyramidpattern68.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
height = int(input())
2+
3+
for i in range(0,height+1):
4+
5+
for j in range(0,height-i+1):
6+
print(end=" ")
7+
8+
for j in range(0,i):
9+
10+
if(i%2 == 0):
11+
print(j+1,end=" ")
12+
13+
else:
14+
c = chr(j+65)
15+
print(c,end=" ")
16+
17+
print()
18+
19+
# Sample Input :- 5
20+
# Output :-
21+
# A
22+
# 1 2
23+
# A B C
24+
# 1 2 3 4
25+
# A B C D E

Pyramid Patterns/pyramidpattern69.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
height = int(input())
2+
3+
for i in range(0,height+1):
4+
5+
for j in range(0,height-i+1):
6+
print(end=" ")
7+
8+
for j in range(0,i):
9+
10+
if(i%2 == 0):
11+
c = chr(i+64)
12+
print(c,end=" ")
13+
14+
else:
15+
print(i,end=" ")
16+
17+
print()
18+
19+
# Sample Input :- 5
20+
# Output :-
21+
# 1
22+
# B B
23+
# 3 3 3
24+
# D D D D
25+
# 5 5 5 5 5

Pyramid Patterns/pyramidpattern70.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
height = int(input())
2+
3+
for i in range(0,height+1):
4+
5+
for j in range(0,height-i+1):
6+
print(end=" ")
7+
8+
for j in range(0,i):
9+
10+
if(i%2 == 0):
11+
c = chr(j+65)
12+
print(c,end=" ")
13+
14+
else:
15+
print(j+1,end=" ")
16+
17+
print()
18+
19+
# Sample Input :- 5
20+
# Output :-
21+
# 1
22+
# A B
23+
# 1 2 3
24+
# A B C D
25+
# 1 2 3 4 5

Pyramid Patterns/pyramidpattern71.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
height = int(input())
2+
3+
for i in range(0,height+1):
4+
5+
for j in range(0,i):
6+
print(end=" ")
7+
8+
for j in range(height,i,-1):
9+
10+
if(i%2 == 0):
11+
c = chr(height-i+64)
12+
print(c,end=" ")
13+
14+
else:
15+
print(height-i,end=" ")
16+
17+
print()
18+
19+
# Sample Input :- 5
20+
# Output :-
21+
# E E E E E
22+
# 4 4 4 4
23+
# C C C
24+
# 2 2
25+
# A
26+

Pyramid Patterns/pyramidpattern72.py

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

Pyramid Patterns/pyramidpattern73.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
height = int(input())
2+
3+
for i in range(0,height+1):
4+
5+
for j in range(0,i):
6+
print(end=" ")
7+
8+
for j in range(height,i,-1):
9+
10+
if(i%2 == 0):
11+
print(height-i,end=" ")
12+
13+
else:
14+
c = chr(height-i+64)
15+
print(c,end=" ")
16+
17+
print()
18+
19+
# Sample Input :- 5
20+
# Output :-
21+
# 5 5 5 5 5
22+
# D D D D
23+
# 3 3 3
24+
# B B
25+
# 1
26+

Pyramid Patterns/pyramidpattern74.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
height = int(input())
2+
3+
for i in range(0,height+1):
4+
5+
for j in range(0,i):
6+
print(end=" ")
7+
8+
for j in range(height,i,-1):
9+
10+
if(i%2 == 0):
11+
print(height-j+1,end=" ")
12+
13+
else:
14+
c = chr(height-j+65)
15+
print(c,end=" ")
16+
17+
print()
18+
19+
# Sample Input :- 5
20+
# Output :-
21+
# 1 2 3 4 5
22+
# A B C D
23+
# 1 2 3
24+
# A B
25+
# 1
26+

0 commit comments

Comments
 (0)