Skip to content

Commit b1c37c9

Browse files
committed
Solved 20 issues
Solved from pyramid pattern 2 - pyramid pattern 21
1 parent 2fc448b commit b1c37c9

20 files changed

+252
-35
lines changed

Pyramid Patterns/pyramidpattern10.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
print("Enter the number of rows: ")
2+
n = int(input())
3+
spaces = 1
4+
counter = n
5+
for i in range(0, n):
6+
for k in range(0, spaces):
7+
print(" ", end="")
8+
for j in range(counter, 0, -1):
9+
print(chr(j+64), end=" ")
10+
counter = counter - 1
11+
print()
12+
spaces = spaces + 1

Pyramid Patterns/pyramidpattern11.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
print("Enter the number of rows: ")
2+
n = int(input())
3+
spaces = 1
4+
counter = n
5+
for i in range(0, n):
6+
for k in range(0, spaces):
7+
print(" ", end="")
8+
for j in range(0, counter):
9+
print(chr(j+65), end=" ")
10+
counter = counter - 1
11+
print()
12+
spaces = spaces + 1

Pyramid Patterns/pyramidpattern12.py

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1-
n = 5 # size
2-
for i in range(n):
3-
print(" "*(-1*i+n-1)+"*"*(2*i+1))
4-
5-
'''
6-
7-
Output:
8-
9-
*
10-
***
11-
*****
12-
*******
13-
*********
14-
15-
'''
1+
print("Enter the number of rows: ")
2+
n = int(input())
3+
spaces = n + (n - 1)
4+
counter = 1
5+
for i in range(0, n):
6+
for k in range(0, spaces):
7+
print(" ", end="")
8+
for j in range(0, counter):
9+
print("*", end=" ")
10+
counter = counter + 2
11+
print()
12+
spaces = spaces - 2

Pyramid Patterns/pyramidpattern13.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
print("Enter the number of rows: ")
2+
n = int(input())
3+
spaces = n + (n - 1)
4+
counter = 1
5+
for i in range(0, n):
6+
for k in range(0, spaces):
7+
print(" ", end="")
8+
for j in range(0, counter):
9+
print(i+1, end=" ")
10+
counter = counter + 2
11+
print()
12+
spaces = spaces - 2

Pyramid Patterns/pyramidpattern14.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
print("Enter the number of rows: ")
2+
n = int(input())
3+
spaces = n + (n - 1)
4+
counter = 1
5+
for i in range(0, n):
6+
for k in range(0, spaces):
7+
print(" ", end="")
8+
for j in range(0, counter):
9+
print(counter, end=" ")
10+
counter = counter + 2
11+
print()
12+
spaces = spaces - 2

Pyramid Patterns/pyramidpattern15.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
print("Enter the number of rows: ")
2+
n = int(input())
3+
spaces = n + (n - 1)
4+
counter = 1
5+
for i in range(0, n):
6+
for k in range(0, spaces):
7+
print(" ", end="")
8+
for j in range(0, counter):
9+
print(j+1, end=" ")
10+
counter = counter + 2
11+
print()
12+
spaces = spaces - 2

Pyramid Patterns/pyramidpattern16.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
print("Enter the number of rows: ")
2+
n = int(input())
3+
spaces = n + (n - 1)
4+
counter = 1
5+
for i in range(0, n):
6+
for k in range(0, spaces):
7+
print(" ", end="")
8+
for j in range(counter, 0, -1):
9+
print(j, end=" ")
10+
counter = counter + 2
11+
print()
12+
spaces = spaces - 2

Pyramid Patterns/pyramidpattern17.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
print("Enter the number of rows: ")
2+
n = int(input())
3+
spaces = n + (n - 1)
4+
counter = 1
5+
for i in range(n, 0, -1):
6+
for k in range(0, spaces):
7+
print(" ", end="")
8+
for j in range(0, counter):
9+
print(i, end=" ")
10+
counter = counter + 2
11+
print()
12+
spaces = spaces - 2

Pyramid Patterns/pyramidpattern18.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
print("Enter the number of rows: ")
2+
n = int(input())
3+
spaces = n + (n - 1)
4+
counter = 1
5+
for i in range(n, 0, -1):
6+
n = i
7+
for k in range(0, spaces):
8+
print(" ", end="")
9+
for j in range(0, counter):
10+
print(n, end=" ")
11+
n = n + 1
12+
counter = counter + 2
13+
print()
14+
spaces = spaces - 2

Pyramid Patterns/pyramidpattern19.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
print("Enter the number of rows: ")
2+
n = int(input())
3+
f = n
4+
spaces = n + (n - 1)
5+
counter = 1
6+
for i in range(n, 0, -1):
7+
a = f
8+
for k in range(0, spaces):
9+
print(" ", end="")
10+
for j in range(0, counter):
11+
print(a, end=" ")
12+
a = a - 1
13+
counter = counter + 2
14+
print()
15+
f = f + 1
16+
spaces = spaces - 2

0 commit comments

Comments
 (0)