# Python Program to Print Star Pyramid Patterns

## Print Star Pyramid Patterns in Python

To print star pyramid patterns in python, you have to use two or more than two for loops. In program that prints pattern contains two for loops, the first loop is responsible for rows and the second for loop is responsible for columns. Here you will find the code and learn how to print star pattern, star pyramid pattern, number pattern, number pyramid pattern, alphabet pattern, alphabet pyramid pattern, etc.

## Python Pattern Programs

Here, you will find many code to print different-different patterns in python. All pattern programs given along with their respective output.

## Python Programming Code to Print Patterns

Let's start with pattern programming using python to print star, number and alphabet pyramid patterns.

## Python Pattern Program No.1

Following python program prints the pyramid pattern of stars:

# Python Program - Pattern Program 1

for i in range(0, 5):
for j in range(0, i+1):
print("* ",end="")
print()

Here is the sample run of the above python program to illustrates how to print pattern using stars:

## Python Pattern Program No.2

Following python program also prints the pyramid pattern of stars but in different style:

# Python Program - Pattern Program 2

k = 1
for i in range(0, 5):
for j in range(0, k):
print("* ", end="")
k = k + 2
print()

Here is the sample run of the above python program to illustrates the pattern printing of stars:

## Python Pattern Program No.3

Following python program also prints the pyramid pattern of stars but in third style:

# Python Program - Pattern Program 3

k = 8
for i in range(0, 5):
for j in range(0, k):
print(end=" ")
k = k - 2
for j in range(0, i+1):
print("* ", end="")
print()

Here is the sample run of the above python pattern program:

## Python Pattern Program No.4

Here is another python pattern program prints pyramid pattern of stars in fourth style:

# Python Program - Pattern Program 4

k = 16
tim = 1
for i in range(0, 5):
for j in range(0, k):
print(end=" ")
k = k - 4
for j in range(0, tim):
print("* ", end="")
tim = tim + 2
print()

Here is the sample run of the above Python program:

## Python Pattern Program No.5

Following python program prints the pyramid pattern of numbers:

# Python Program - Pattern Program 5

n = 1
for i in range(0, 5):
for j in range(0, i+1):
print(n, end=" ")
n = n + 1
print()

Here is the sample run of the above python program to show how to print the pyramid pattern of numbers:

## Python Pattern Program No.6

Following python program prints the pyramid pattern of numbers in second style:

# Python Program - Pattern Program 6

num = 1
for i in range(0, 5):
num = 1
for j in range(0, i+1):
print(num, end=" ")
num = num + 1
print()

Here is the sample run of the above Python program:

## Pyramid Pattern Program No.7

Following python program print the pattern of stars in another style:

# Python Program - Pattern Program 7

k = 0
rows = 10
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 = k + 1
k = 0
print()

Here is the sample run of the above Python program:

## Python Pattern Program No.8

Following python program prints the pyramid pattern of alphabets:

# Python Program - Pattern Program 8

val = 65
for i in range(0, 5):
for j in range(0, i+1):
ch = chr(val)
print(ch, end=" ")
val = val + 1
print()

Here is the sample run of the above Python program to illustrates how to print pyramid pattern of alphabets:

## Python Pattern Program No.9

Following python program also prints the pyramid pattern of alphabets in different style:

# Python Program - Pattern Program 9

val = 65
for i in range(0, 5):
for j in range(0, i+1):
ch = chr(val)
print(ch, end=" ")
val = val + 1
print()

Here is the sample run of the above Python program:

## Python Pattern Program No.10

Below is another python program print pattern of stars:

# Python Program - Pattern Program 10

for i in range(0, 5):
for j in range(5, i, -1):
print("* ", end="")
print()

Here is the sample run of the above Python program:

## Python Pattern Program No.11

Here is another python program to print pattern of numbers:

# Python Program - Pattern Program 11

num = 1
for i in range(0, 5):
for j in range(5, i, -1):
print(num, end=" ")
num = num + 1
print()
num = 1

Here is the sample run of the above Python program:

## Python Pattern Program No.12

This is another version of pattern program in python to print pattern of numbers:

# Python Program - Pattern Program 12

num = 1
incr = 1
for i in range(0, 5):
for j in range(0, incr):
print(num, end=" ")
num = num + 1
print()
incr = incr + 2

Here is the sample run of the above Python program:

## Python Pattern Program No.13

This is the another version of pattern program in python to print pattern of numbers:

# Python Program - Pattern Program 13

num = 1
count = 0
decr = 8
for i in range(0, 5):
for k in range(0, decr):
print(end=" ")
for j in range(0, i):
count = count + 1
num = count
temp = num
for j in range(0, i):
print(num, end=" ")
num = num - 1
print()
num = temp
decr = decr - 2

Here is the sample run of the above Python program:

## Python Pattern Program No.14

Below is another version of pattern printing program in python to illustrates how to print pattern of alphabets:

# Python Program - Pattern Program 14

incr = 1
val = 65
for i in range(0, 5):
for j in range(0, incr):
ch = chr(val)
print(ch, end=" ")
val = val + 1
incr = incr + 2
print()

Here is the sample run of the above Python program:

## Python Pattern Program No.15

Let's see another pattern program in python to print pattern of alphabets:

# Python Program - Pattern Program 15

decr = 8
count = 64
val = 65
for i in range(0, 5):
for k in range(0, decr):
print(end=" ")
for j in range(0, i+1):
count = count + 1
val = count
temp = val
for j in range(0, i+1):
ch = chr(val)
print(ch, end=" ")
val = val - 1
val = temp
decr = decr - 2
print()

Here is the sample run of the above Python program:

### Same Program in Other Languages

You may also like to learn or practice the same program in other popular programming languages:

Tools
Calculator