Welcome to the World of Online Learning:
Hello Friends “This blog helps you to learn Python programming concepts. You can learn Python language at your own speed and time. One can learn concepts of Python language by practicing various programs given on various pages of this blog. Enjoy the power of Self-learning using the Internet.”

Write a Python Program to Create Pyramid Patterns
PROGRAM: Python Program to Create Pyramid Patterns
/* Python Program to Create Pyramid Patterns */
1: Program to print half pyramid using *
rows = int(input(“Enter number of rows: “))
for i in range(rows):
for j in range(i+1):
print(“* “, end=””)
print()
OUTPUT:-
*
* *
* * *
* * * *
* * * * *
2: Program to print half pyramid a using numbers
rows = int(input(“Enter number of rows: “))
for i in range(rows):
for j in range(i+1):
print(j+1, end=” “)
print()
OUTPUT:-
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
3: Program to print half pyramid using alphabets
rows = int(input(“Enter number of rows: “))
ascii_value = 65
for i in range(rows):
for j in range(i+1):
alphabet = chr(ascii_value)
print(alphabet, end=” “)
ascii_value += 1
print()
OUTPUT:-
A
B B
C C C
D D D D
E E E E E
4: Inverted half pyramid using *
rows = int(input(“Enter number of rows: “))
for i in range(rows, 0, -1):
for j in range(0, i):
print(“* “, end=” “)
print()
OUTPUT:-
* * * * *
* * * *
* * *
* *
*
5: Inverted half pyramid using numbers
rows = int(input(“Enter number of rows: “))
for i in range(rows, 0, -1):
for j in range(1, i+1):
print(j, end=” “)
print()
OUTPUT:-
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
6: Program to print full pyramid using *
rows = int(input(“Enter number of rows: “))
k = 0
for i in range(1, rows+1):
for space in range(1, (rows-i)+1):
print(end=” “)
while k!=(2*i-1):
print(“* “, end=””)
k += 1
k = 0
print()
OUTPUT:-
*
* * *
* * * * *
* * * * * * *
* * * * * * * * *
7: Full Pyramid of Numbers
rows = int(input(“Enter number of rows: “))
k = 0
count=0
count1=0
for i in range(1, rows+1):
for space in range(1, (rows-i)+1):
print(” “, end=””)
count+=1
while k!=((2*i)-1):
if count<=rows-1:
print(i+k, end=” “)
count+=1
else:
count1+=1
print(i+k-(2*count1), end=” “)
k += 1
count1 = count = k = 0
print()
OUTPUT:-
1
2 3 2
3 4 5 4 3
4 5 6 7 6 5 4
5 6 7 8 9 8 7 6 5