Do you want to learn how to make different patterns in python.Here in this article you will find 20 python programs for different pyramid patterns.

When preparing for Python-related jobs as a beginner, you need to practice pattern programs to better understand conditional statements and loops in Python. Performing pattern printing are interviewer-favorite questions to test your Python skills. This article has compiled a list of the 20 most common pattern programs in python to help you prepare for that job! So, without further ado, let’s get started, shall we?

*Explore** How to Find an Armstrong Number Using Python*

**How to Print Patterns in Python**

In Python, we commonly use multiple for loops, and sometimes while loops too, to print the various patterns. Here, the first outer loop is used to print the **number of rows**, and the inner loop is used to print the **number of columns** of the said pattern. Most pattern programs are a variation of each other and work on the same logic.

We will be covering the following pattern programs today:

- Simple * Pattern Pyramid
- Simple Number Pyramid
- Simple Alphabet Pyramid
- Simple Inverted * Pattern Pyramid
- Simple Inverted Number Pyramid
- Simple Inverted Number Pyramid in Descending Order
- Simple Inverted Pyramid of a Digit
- Number Pattern Semi-Pyramid
- Number Pattern Mirrored Semi-Pyramid
- Number Pattern Inverted Semi-Pyramid
- Reverse Number Pyramid
- Natural Number Pyramid
- Palindrome Number Pyramid
- Alternate/Odd Number Pyramid
- Even Number Pyramid in Descending Order
- Horizontal Tables Pyramid
- Equilateral Pyramid of * Pattern
- Inverted Equilateral Pyramid of * Pattern
- Full Pyramid of Numbers
- Pascal’s Triangle Pyramid

**Simple * Pattern Pyramid**

#Outer for loop to handle number of rows for i in range(0, rows): #Inner for loop to handle number of columns #values change according to the outer loop for j in range(0, i + 1): print("* ", end=" ") #End line after each row print()

**Output:**

*Also explore: Your One Stop Guide to Learn About Python*

**Simple Alphabet Pyramid**

rows = int(input("Enter the number of rows: "))
#Outer for loop to handle number of rows for num in range(rows+1): #Inner for loop to handle number of columns #values change according to the outer loop for i in range(num): print(num, end=" ") #End line after each row print()

**Output:**

**Simple Inverted * Pattern Pyramid**

rows = int(input("Enter number of rows: "))
ascii_value = 65
#Outer for loop to handle number of rows for i in range(rows): #Inner for loop to handle number of columns #values change according to the outer loop for j in range(i+1): alphabet = chr(ascii_value) print(alphabet, end=" ") ascii_value += 1 print()

**Output:**

**Simple Inverted Number Pyramid**

rows = int(input("Enter the number of rows: "))
#Outer for loop executing in reverse orderfor i in range(rows + 1, 0, -1): #Inner for loop to handle number of columns #values change according to the outer loop for j in range(0, i - 1): print("* ", end=" ") #End line after each row print()

**Output:**

**Simple Inverted Number Pyramid in Descending Order**

rows = int(input("Enter the number of rows: "))
#Outer for loop executing in reverse orderfor i in range(rows, 0, -1): num = i #Inner for loop to handle number of columns #values change according to the outer loop for j in range(0, i): print(num, end=" ") #End line after each row print()

**Output:**

**Simple Inverted Pyramid of a Digit**

rows = int(input("Enter the number of rows: ")) num = rows
#Outer for loop executing in reverse orderfor i in range(rows, 0, -1): #Inner for loop to handle number of columns #values change according to the outer loop for j in range(0, i): print(num, end=" ") #End line after each row print()

**Output:**

**Number Pattern Semi-Pyramid**

rows = int(input("Enter the number of rows: "))
#Outer for loop to handle number of rows for i in range(1, rows+1): #Inner for loop to handle number of columns #values change according to the outer loop for j in range(1, i + 1): print(j, end=" ") #End line after each row print()

**Output:**

**Number Pattern Mirrored Semi-Pyramid**

rows = int(input("Enter the number of rows: "))
#Outer for loop to handle number of rows for i in range(1, rows+1): num = 1 #Inner for loop to handle number of columns #values change according to the outer loop for j in range(rows,0,-1): if j > i: print(" ", end=" ") else: print(num, end=" ") num += 1 #End line after each row print()

**Output:**

**Number Pattern Inverted Semi-Pyramid**

rows = int(input("Enter the number of rows: "))
#Outer for loop to handle number of rows for i in range(rows,0,-1): #Inner for loop to handle number of columns #values change according to the outer loop for j in range(0, i + 1): print(j, end=" ") #End line after each row print()

**Output:**

**Reverse Number Pyramid**

rows = int(input("Enter the number of rows: "))
#Outer for loop to handle number of rows for i in range(1, rows+1): #Inner for loop to handle number of columns #values change according to the outer loop for j in range(i,0,-1): print(j, end=" ") #End line after each row print()

**Output:**

**Natural Number Pyramid**

rows = int(input("Enter the number of rows: ")) num = 1stop = 2
#Outer for loop to handle number of rows for i in range(rows): #Inner for loop to handle number of columns #values change according to the outer loop for j in range(1, stop): print(num, end=" ") num += 1 #End line after each row print() stop += 2

**Output:**

**Palindrome Number Pyramid**

rows = int(input("Enter the number of rows: "))
#Outer for loop to handle number of rows for i in range(1, rows+1): for j in range(1, i-1): print(j, end=" ") num += 1 for j in range(i-1,0,-1): print(j, end=" ") print()

**Output:**

**Alternate/Odd Number Pyramid**

rows = int(input("Enter the number of rows: ")) i = 1
while i <= rows: j = 1 while j <= i: print((i * 2-1), end=" ") j += 1 i += 1
print()

**Output:**

**Even Number Pyramid in Descending Order**

rows = int(input("Enter the number of rows: ")) lastnum = 2 * rowseven = lastnum
#Outer for loop to handle number of rows for i in range(1, rows+1): even = lastnum for j in range(i): print(even, end=" ") even -= 2 print()

**Output:**

**Horizontal Tables Pyramid**

rows = int(input("Enter the number of rows: "))
#Outer for loop to handle number of rows for i in range(0, rows): #Inner for loop to handle number of columns #values change according to the outer loop for j in range(0, i+1): print(i*j, end=" ")
#End line after each row print()

**Output:**

**Equilateral Pyramid of * Pattern**

rows = int(input("Enter the number of rows: ")) m = (2*rows)-2
#Outer for loop to handle number of rows for i in range(0, rows): #Inner for loop to handle number of columns #values change according to the outer loop for j in range(0, m): print(end=" ") #decrementing m after each loop m -= 1 for j in range(0, i+1): #printing triangle pyramid using asterik print("*",end=" ") #End line after each row print()

**Output:**

**Inverted Equilateral Pyramid of * Pattern**

rows = int(input("Enter the number of rows: ")) m = (2*rows)-2
#Outer for loop to handle number of rows for i in range(rows-1,-1,-1): #Inner for loop to handle number of columns #values change according to the outer loop for j in range(m,0,-1): print(end=" ") #incrementing m after each loop m += 1 for j in range(0, i+1): #printing triangle pyramid using asterik print("*",end=" ") #End line after each row print()

**Output:**

**Full Pyramid of Numbers **

rows = int(input("Enter number of rows: "))
k = 0count=0count1=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:**

**Pascal’s Triangle Pyramid **

rows = int(input("Enter number of rows: "))coef = 1
for i in range(1, rows+1): for space in range(1, rows-i+1): print(" ",end="") for j in range(0, i): if j==0 or i==0: coef = 1 else: coef = coef * (i - j)//j print(coef, end = " ") print()

**Output:**

**Endnotes**

In this article, we have discussed 20 questions on pattern programming in Python. These are basic programming problem for beginners.

Keep Learning!!

Keep Sharing!!

**Top Trending Article**

Top Online Python Compiler | How to Check if a Python String is Palindrome | Feature Selection Technique | Conditional Statement in Python | How to Find Armstrong Number in Python | Data Types in Python | How to Find Second Occurrence of Sub-String in Python String | For Loop in Python |Prime Number | Inheritance in Python | Validating Password using Python Regex | Python List |Market Basket Analysis in Python | Python Dictionary | Python While Loop | Python Split Function | Rock Paper Scissor Game in Python | Python String | How to Generate Random Number in Python | Python Program to Check Leap Year | Slicing in Python

**Interview Questions**

Data Science Interview Questions | Machine Learning Interview Questions | Statistics Interview Question | Coding Interview Questions | SQL Interview Questions | SQL Query Interview Questions | Data Engineering Interview Questions | Data Structure Interview Questions | Database Interview Questions | Data Modeling Interview Questions | Deep Learning Interview Questions |

**About the Author**

This is a collection of insightful articles from domain experts in the fields of Cloud Computing, DevOps, AWS, Data Science, Machine Learning, AI, and Natural Language Processing. The range of topics caters to upski... Read Full Bio

## Comments