This article shows the list of available Star Pattern Programs in the Python programming language with an example of each. Please use the hyperlinks to understand the code of each program deeply.
Apart from the Star Pattern Programs, Python also allows you to write the Number and Alphabet pattern programs. We have. covered each of them in separate Python Number Pattern Programs and Python Alphabet Pattern programs articles so that you can understand them better.
Please refer to the Python language to understand the syntax and the loops.
- Python for loop
- Python while loop
- functions in Python
- For the regular lab examples, refer to the Python programs.
Python Star Pattern Programs
The following are the Star Pattern Programs executed (explained) using the for loop.
Python Program to Print Diamond Star Pattern
This section explains the list of available diamond star pattern programs with examples. For more information on the Python diamond star pattern.
def programLogic(rows, i):
for j in range(1, rows - i + 1):
print(end = ' ')
for k in range(1, i * 2):
print('*', end = '')
print()
rows = int(input("Enter Diamond Pattern Rows = "))
for i in range(1, rows + 1):
programLogic(rows, i)
for i in range(rows - 1, 0, -1):
programLogic(rows, i)
Output
Enter Diamond Pattern Rows = 10
*
***
*****
*******
*********
***********
*************
***************
*****************
*******************
*****************
***************
*************
***********
*********
*******
*****
***
*
Hollow Diamond Star Pattern
For more information on printing the Python Hollow Diamond Star Pattern.
def programLogic(rows, i):
for j in range(1, rows - i + 1):
print(end = ' ')
for k in range(1, i * 2):
if k == 1 or k == i * 2 - 1:
print('*', end = '')
else:
print(' ', end = '')
print()
rows = int(input("Enter Hollow Diamond Pattern Rows = "))
for i in range(1, rows + 1):
programLogic(rows, i)
for i in range(rows - 1, 0, -1):
programLogic(rows, i)
Output
Enter Hollow Diamond Pattern Rows = 9
*
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
*
Half Diamond Star Pattern
For more information on printing the Python Half Diamond Star Pattern.
def programLogic(rows, i):
for j in range(1, i + 1):
print('*', end = '')
print()
rows = int(input("Enter Half Diamond Pattern Rows = "))
for i in range(1, rows + 1):
programLogic(rows, i)
for i in range(rows - 1, 0, -1):
programLogic(rows, i)
Output
Enter Half Diamond Pattern Rows = 9
*
**
***
****
*****
******
*******
********
*********
********
*******
******
*****
****
***
**
*
Hollow Half Diamond Star Pattern
For more information on printing the Python Hollow Half Diamond Star Pattern.
def programLogic(rows, i):
for j in range(1, i + 1):
if i == j or j == 1:
print('*', end = '')
else:
print(' ', end = '')
print()
rows = int(input("Enter Hollow Half Diamond Pattern Rows = "))
for i in range(1, rows + 1):
programLogic(rows, i)
for i in range(rows - 1, 0, -1):
programLogic(rows, i)
Output
Enter Hollow Half Diamond Pattern Rows = 10
*
**
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
**
*
Mirrored Half Diamond Star Pattern
For more information on the Python program to print the Mirrored Half Diamond Star Pattern.
def programLogic(rows, i):
for j in range(1, rows - i + 1):
print(end = ' ')
for k in range(1, i + 1):
print('*', end = '')
print()
rows = int(input("Enter Mirrored Half Diamond Pattern Rows = "))
for i in range(1, rows + 1):
programLogic(rows, i)
for i in range(rows - 1, 0, -1):
programLogic(rows, i)
Output
Enter Mirrored Half Diamond Pattern Rows = 10
*
**
***
****
*****
******
*******
********
*********
**********
*********
********
*******
******
*****
****
***
**
*
Hollow Mirrored Half Diamond Star Pattern
For more information on printing the Python Hollow Mirrored Half Diamond Star Pattern.
def programLogic(rows, i):
for j in range(1, rows - i + 1):
print(end = ' ')
for k in range(1, i + 1):
if i == k or k == 1:
print('*', end = '')
else:
print(' ', end = '')
print()
rows = int(input("Enter Hollow Mirrored Half Diamond Rows = "))
for i in range(1, rows + 1):
programLogic(rows, i)
for i in range(rows - 1, 0, -1):
programLogic(rows, i)
Output
Enter Hollow Mirrored Half Diamond Rows = 12
*
**
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
**
*
Hollow Diamond inside a Square Star Pattern
For more information on printing the Python Diamond inside a Square Star Pattern.
def firstLoop(rows, i):
for j in range(i, rows + 1):
print('*', end = '')
def secondLoop(rows, i):
for j in range(1, i + 1):
print('*', end = '')
rows = int(input("Enter Diamond inside a Square Rows = "))
for i in range(1, rows + 1):
firstLoop(rows, i)
for k in range(1, i * 2 ):
print(' ', end = '')
firstLoop(rows, i)
print()
for i in range(1, rows + 1):
secondLoop(rows, i)
for k in range(i * 2 - 2, 2 * rows - 1):
print(' ', end = '')
secondLoop(rows, i)
print()
Output
Enter Diamond inside a Square Rows = 9
********* *********
******** ********
******* *******
****** ******
***** *****
**** ****
*** ***
** **
* *
* *
** **
*** ***
**** ****
***** *****
****** ******
******* *******
******** ********
********* *********
Left Pascals Triangle
For more information on printing the Python Left Pascals Star Triangle Star Pattern.
def programLogic(rows, i):
for l in range(i, rows):
print(end = ' ')
for m in range(1, i+ 1):
print('*', end = ' ')
print()
rows = int(input("Enter Left Pascals Star Triangle Pattern Rows = "))
for i in range(1, rows + 1):
programLogic(rows, i)
for i in range(rows - 1, 0, -1):
programLogic(rows, i)
Output
Enter Left Pascals Star Triangle Pattern Rows = 11
*
* *
* * *
* * * *
* * * * *
* * * * * *
* * * * * * *
* * * * * * * *
* * * * * * * * *
* * * * * * * * * *
* * * * * * * * * * *
* * * * * * * * * *
* * * * * * * * *
* * * * * * * *
* * * * * * *
* * * * * *
* * * * *
* * * *
* * *
* *
*
Hollow Left Pascals Triangle
For more information on printing the Python Hollow Left Pascals Triangle Star Pattern.
def programLogic(rows, i):
for l in range(i, rows):
print(' ', end = '')
for j in range(1, i + 1):
if j == 1 or j == i:
print('* ', end = '')
else:
print(' ', end = '')
print()
rows = int(input("Enter Hollow Left Pascals Triangle Rows = "))
for i in range(1, rows + 1):
programLogic(rows, i)
for i in range(rows - 1, 0, -1):
programLogic(rows, i)
Output
Enter Hollow Left Pascals Triangle Rows = 7
*
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
*
Right Pascals Triangle
For more information on printing the Python Right Pascals Triangle Star Pattern.
def programLogic(rows, i):
for j in range(i):
print('* ', end = '')
print()
rows = int(input("Enter Right Pascals Triangle Rows = "))
for i in range(rows):
programLogic(rows, i)
for i in range(rows, -1, -1):
programLogic(rows, i)
Output
Enter Right Pascals Triangle Rows = 11
*
* *
* * *
* * * *
* * * * *
* * * * * *
* * * * * * *
* * * * * * * *
* * * * * * * * *
* * * * * * * * * *
* * * * * * * * * * *
* * * * * * * * * *
* * * * * * * * *
* * * * * * * *
* * * * * * *
* * * * * *
* * * * *
* * * *
* * *
* *
*
Hollow Right Pascals Star Triangle
For more information on printing the Python Hollow Right Pascals Triangle Star Pattern.
def programLogic(rows, i):
for j in range(i):
if j == 0 or j == i - 1:
print('* ', end = '')
else:
print(' ', end = '')
print()
rows = int(input("Enter Hollow Right Pascals Triangle Rows = "))
for i in range(rows):
programLogic(rows, i)
for i in range(rows, -1, -1):
programLogic(rows, i)
Output
Enter Hollow Right Pascals Triangle Rows = 12
*
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
*
Python Program to Print Pyramid Star Pattern
This section explains the list of available pyramid star pattern programs with examples. For more information on printing the Python Pyramid Star Pattern.
rows = int(input("Enter Pyramid Pattern Rows = "))
for i in range(rows):
for j in range(rows - i - 1):
print(end = ' ')
for k in range(i + 1):
print('*', end = ' ')
print()
Output
Enter Pyramid Pattern Rows = 10
*
* *
* * *
* * * *
* * * * *
* * * * * *
* * * * * * *
* * * * * * * *
* * * * * * * * *
* * * * * * * * * *
Hollow Pyramid Star Pattern
For more information on the program to print the Python Hollow Pyramid Star Pattern.
n = int(input("Enter Hollow Pyramid Rows = "))
for i in range(1, n + 1):
for j in range(1, n - i + 1):
print(' ', end = '')
for k in range(1, i * 2 ):
if i == 1 or i == n or k == 1 or k == i * 2 - 1:
print('*', end = '')
else:
print(' ', end = '')
print()
Output
Enter Hollow Pyramid Rows = 12
*
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
***********************
Inverted Pyramid Star Pattern
For more information on printing the Python Inverted Pyramid Star Pattern.
rows = int(input("Enter Inverted Pyramid Pattern Rows = "))
for i in range(rows, 0, -1):
for j in range(rows - i):
print(end = ' ')
for k in range(i):
print('*', end = ' ')
print()
Output
Enter Inverted Pyramid Pattern Rows = 10
* * * * * * * * * *
* * * * * * * * *
* * * * * * * *
* * * * * * *
* * * * * *
* * * * *
* * * *
* * *
* *
*
Hollow Inverted Pyramid Star Pattern
For more information on printing the Python Hollow Inverted Pyramid Star Pattern.
n = int(input("Enter Hollow Inverted Pyramid Pattern Rows = "))
for i in range(n, 0, -1):
for j in range(n - i):
print(end = ' ')
for k in range(i):
if (i == 1 or i == n or k == 0 or k == i - 1):
print('*', end = ' ')
else:
print(' ', end = ' ')
print()
Output
Enter Hollow Inverted Pyramid Pattern Rows = 12
* * * * * * * * * * * *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
*
Program to Print Rectangle Star Pattern
This section explains the list of available rectangle star pattern programs with examples. For more information on printing the Python Rectangle Star Pattern.
rows = int(input("Enter the Rows : "))
columns = int(input("Enter the Columns : "))
for i in range(rows):
for j in range(columns):
print('*', end = ' ')
print()
Output
Enter the Rows : 12
Enter the Columns : 15
* * * * * * * * * * * * * * *
* * * * * * * * * * * * * * *
* * * * * * * * * * * * * * *
* * * * * * * * * * * * * * *
* * * * * * * * * * * * * * *
* * * * * * * * * * * * * * *
* * * * * * * * * * * * * * *
* * * * * * * * * * * * * * *
* * * * * * * * * * * * * * *
* * * * * * * * * * * * * * *
* * * * * * * * * * * * * * *
* * * * * * * * * * * * * * *
Hollow Rectangle Star Pattern
For more information on printing the Python Hollow Rectangle Star Pattern.
rows = int(input("Enter the Rows : "))
columns = int(input("Enter the Columns : "))
for i in range(rows):
for j in range(columns):
if(i == 0 or i == rows - 1 or j == 0 or j == columns - 1):
print('*', end = ' ')
else:
print(' ', end = ' ')
print()
Output
Enter the Rows : 10
Enter the Columns : 16
* * * * * * * * * * * * * * * *
* *
* *
* *
* *
* *
* *
* *
* *
* * * * * * * * * * * * * * * *
Python Program to Print Rhombus Star Pattern
This section explains the list of available Rhombus star pattern programs with examples. For more information on printing the Python Rhombus Star Pattern.
rows = int(input("Enter Rhombus Star Pattern Rows = "))
for i in range(rows, 0, -1):
for j in range(1, i):
print(' ', end = ' ')
for k in range(rows):
print('*', end = ' ')
print()
Output
Enter Rhombus Star Pattern Rows = 9
* * * * * * * * *
* * * * * * * * *
* * * * * * * * *
* * * * * * * * *
* * * * * * * * *
* * * * * * * * *
* * * * * * * * *
* * * * * * * * *
* * * * * * * * *
Hollow Rhombus Star Pattern
For more information on printing the Python Hollow Rhombus Star Pattern.
rows = int(input("Enter Hollow Rhombus Star Pattern Rows = "))
for i in range(rows, 0, -1):
for j in range(1, i):
print(' ', end = ' ')
for k in range(rows):
if(i == 1 or i == rows or k == 0 or k == rows - 1):
print('*', end = ' ')
else:
print(' ', end = ' ')
print()
Output
Enter Hollow Rhombus Star Pattern Rows = 10
* * * * * * * * * *
* *
* *
* *
* *
* *
* *
* *
* *
* * * * * * * * * *
Mirrored Rhombus Star Pattern
For more information on printing the Python Mirrored Rhombus Star Pattern.
rows = int(input("Enter Mirrored Rhombus Star Pattern Rows = "))
for i in range(rows):
for j in range(i):
print(' ', end = '')
for k in range(rows):
print('*', end = '')
print()
Output
Enter Mirrored Rhombus Star Pattern Rows = 12
************
************
************
************
************
************
************
************
************
************
************
************
Hollow Mirrored Rhombus Star Pattern
For more information on printing the Python Hollow Mirrored Rhombus Star Pattern.
rows = int(input("Enter Hollow Mirrored Rhombus Rows = "))
for i in range(rows):
for j in range(i):
print(' ', end = '')
for k in range(rows):
if i == 0 or i == rows - 1 or k == 0 or k == rows - 1:
print('*', end = '')
else:
print(' ', end = '')
print()
Output
Enter Hollow Mirrored Rhombus Rows = 14
**************
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
**************
Python Program to Print Right Angled Triangle Star Pattern
For more information on printing the Python Right Angled Triangle Star Pattern.
n = int(input("Enter Right Angled Triangle Rows = "))
for i in range(1, n + 1):
for j in range(1, i + 1):
print('*', end = ' ')
print()
Output
Enter Right Angled Triangle Rows = 11
*
* *
* * *
* * * *
* * * * *
* * * * * *
* * * * * * *
* * * * * * * *
* * * * * * * * *
* * * * * * * * * *
* * * * * * * * * * *
Hollow Right Triangle Star Pattern
For more information on printing the Python Hollow Right Triangle Star Pattern.
n = int(input("Enter Hollow Right Angled Triangle Rows = "))
for i in range(1, n + 1):
for j in range(1, i + 1):
if i == 1 or i == n or j == 1 or j == i:
print('*', end = '')
else:
print(' ', end = '')
print()
Output
Enter Hollow Right Angled Triangle Rows = 15
*
**
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
***************
Inverted Right Triangle Star Pattern
For more information on printing the Python Inverted Right Triangle Star Pattern.
rows = int(input("Enter Inverted Right Angled Triangle Rows = "))
for i in range(rows, 0, -1):
for j in range(i, 0, -1):
print('*', end = '')
print()
Output
Enter Inverted Right Angled Triangle Rows = 15
***************
**************
*************
************
***********
**********
*********
********
*******
******
*****
****
***
**
*
Hollow Inverted Right Triangle
For more information on printing the Python Hollow Inverted Right Triangle Star Pattern.
n = int(input("Enter Hollow Inverted Right Angled Triangle Rows = "))
for i in range(n, 0, -1):
for j in range(i, 0, -1):
if i == 1 or i == n or j == 1 or j == i:
print('*', end = '')
else:
print(' ', end = '')
print()
Output
Enter Hollow Inverted Right Angled Triangle Rows = 13
*************
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
**
*
Mirrored Right Triangle Star Pattern
For more information on printing the Python Mirrored Right Triangle Star Pattern.
n = int(input("Enter Mirrored Right Triangle Rows = "))
for i in range(1, n + 1):
for j in range(1, n + 1):
if j <= n - i:
print(' ', end = '')
else:
print('*', end = '')
print()
Output
Enter Mirrored Right Triangle Rows = 14
*
**
***
****
*****
******
*******
********
*********
**********
***********
************
*************
**************
Reverse Mirrored Right Triangle Star Pattern
For more information on the program to print the Python Reverse or Inverted Mirrored Right Triangle Star Pattern.
n = int(input("Enter Reverse Mirrored Right Triangle Rows : "))
for i in range(1, n + 1):
for j in range(1, n + 1):
if(j < i):
print(' ', end = '')
else:
print('*', end = '')
print()
Output
Enter Reverse Mirrored Right Triangle Rows : 15
***************
**************
*************
************
***********
**********
*********
********
*******
******
*****
****
***
**
*
Hollow Mirrored Right Triangle Star Pattern
For more information on printing the Python Hollow Mirrored Right Triangle Star Pattern.
n = int(input("Enter Hollow Mirrored Right Triangle Rows = "))
for i in range(1, n + 1):
for j in range(n - i):
print(' ', end = '')
for k in range(i):
if i == 1 or i == n or k == 0 or k == i - 1:
print('*', end = '')
else:
print(' ', end = '')
print()
Output
Enter Hollow Mirrored Right Triangle Rows = 12
*
**
* *
* *
* *
* *
* *
* *
* *
* *
* *
************
Hollow Inverted Mirrored Right Triangle Star Pattern
For more information on printing the Hollow Inverted or Reversed Mirrored Right Triangle Star Pattern in Python.
n = int(input("Enter Hollow Inverted Mirrored Right Triangle Rows = "))
for i in range(n, 0, -1):
for j in range(n - i, 0, -1):
print(' ', end = '')
for k in range(i):
if i == 1 or i == n or k == 0 or k == i - 1:
print('*', end = '')
else:
print(' ', end = '')
print()
Output
Enter Hollow Inverted Mirrored Right Triangle Rows = 13
*************
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
**
*
Python Program to Print Square Star Pattern
This section explains the list of available Square star pattern programs with examples. For more information on printing the Python Square Star Pattern.
side = int(input("Enter Side of a Square = "))
for i in range(side):
for i in range(side):
print('*', end = ' ')
print()
Output
Enter Side of a Square = 13
* * * * * * * * * * * * *
* * * * * * * * * * * * *
* * * * * * * * * * * * *
* * * * * * * * * * * * *
* * * * * * * * * * * * *
* * * * * * * * * * * * *
* * * * * * * * * * * * *
* * * * * * * * * * * * *
* * * * * * * * * * * * *
* * * * * * * * * * * * *
* * * * * * * * * * * * *
* * * * * * * * * * * * *
* * * * * * * * * * * * *
Hollow Square Star Pattern
For more information on printing the Python Hollow Square Star Pattern.
side = int(input("Enter Side of a Hollow Square = "))
for i in range(side):
for j in range(side):
if(i == 0 or i == side - 1 or j == 0 or j == side - 1):
print('*', end = ' ')
else:
print(' ', end = ' ')
print()
Output
Enter Side of a Hollow Square = 12
* * * * * * * * * * * *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* * * * * * * * * * * *
Hollow Square Star With Diagonals
For more information on printing the Python Hollow Square With Diagonals Star Pattern.
s = int(input("Enter Hollow Square With Diagonals Side = "))
for i in range(s):
for j in range(s):
if(i == 0 or i == s - 1 or j == 0 or j == s - 1
or i == j or j == (s - 1 - i)):
print('* ', end = '')
else:
print(' ', end = '')
print()
Output

Python Program to Print Sandglass Star Pattern
For more information on printing the Python Sandglass Star Pattern.
def programLogic(rows, i):
for j in range(i):
print(end = ' ')
for k in range(i, rows):
print('*', end = ' ')
print()
rows = int(input("Enter Sandglass Star Pattern Rows = "))
for i in range(rows):
programLogic(rows, i)
for i in range(rows - 1, -1, -1):
programLogic(rows, i)
Output
Enter Sandglass Star Pattern Rows = 11
* * * * * * * * * * *
* * * * * * * * * *
* * * * * * * * *
* * * * * * * *
* * * * * * *
* * * * * *
* * * * *
* * * *
* * *
* *
*
*
* *
* * *
* * * *
* * * * *
* * * * * *
* * * * * * *
* * * * * * * *
* * * * * * * * *
* * * * * * * * * *
* * * * * * * * * * *
Hollow Sandglass Star Pattern
For more information on printing the Python Hollow Sandglass Star Pattern.
def programLogic(rows, i):
for j in range(1, i):
print(end = ' ')
for k in range(i, rows + 1):
if i == 1 or k == i or k == rows:
print('*', end = ' ')
else:
print(end = ' ')
print()
rows = int(input("Enter Hollow Sandglass Star Pattern Rows = "))
for i in range(1, rows + 1):
programLogic(rows, i)
for i in range(rows - 1, 0, -1):
programLogic(rows, i)
Output
Enter Hollow Sandglass Star Pattern Rows = 9
* * * * * * * * *
* *
* *
* *
* *
* *
* *
* *
*
* *
* *
* *
* *
* *
* *
* *
* * * * * * * * *
Python Program to Print Triangle Pattern
This section explains the list of available Triangle star pattern programs with examples. For more information on printing the Python Triangle Star Pattern.
n = int(input("Enter Triangle Pattern Rows = "))
for i in range(1, n + 1):
for j in range(n - i):
print(' ', end = '')
for k in range(i * 2 - 1):
print('*', end = '')
print()
Output
Enter Triangle Pattern Rows = 13
*
***
*****
*******
*********
***********
*************
***************
*****************
*******************
*********************
***********************
*************************
Hollow Triangle Pattern
For more information on printing the Python Hollow Triangle Star Pattern.
n = int(input("Enter Hollow Triangle Pattern Rows = "))
for i in range(1, n + 1):
for j in range(n - i):
print(' ', end = '')
for k in range(i * 2 - 1):
if i == 1 or i == n or k == 0 or k == i * 2 - 2:
print('*', end = '')
else:
print(' ', end = '')
print()
Output
Enter Hollow Triangle Pattern Rows = 15
*
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
*****************************
Inverted Triangle Pattern
For more information on printing the Inverted Triangle Star Pattern in Python.
n = int(input("Enter Inverted Triangle Pattern Rows = "))
for i in range(n, 0, -1):
for j in range(1, n - i + 1):
print(' ', end = '')
for k in range(1, i * 2):
print('*', end = '')
print()
Output
Enter Inverted Triangle Pattern Rows = 13
*************************
***********************
*********************
*******************
*****************
***************
*************
***********
*********
*******
*****
***
*
Hollow Inverted Triangle Pattern
For more information on printing the Hollow Inverted Triangle Star Pattern in Python.
n = int(input("Enter Hollow Inverted Triangle Pattern Rows = "))
for i in range(n, 0, -1):
for j in range(1, n - i + 1):
print(' ', end = '')
for k in range(1, i * 2):
if i == 1 or i == n or k == 1 or k == i * 2 - 1:
print('*', end = '')
else:
print(' ', end = '')
print()
Output
Enter Hollow Inverted Triangle Pattern Rows = 15
*****************************
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
*
Downward Triangle Star Pattern
For more information on printing the Python Downward Triangle Star Pattern.
n = int(input("Enter Downward Triangle Pattern Rows = "))
for i in range(n, 0, -1):
for j in range(i):
print('*', end = ' ')
print()
Output
Enter Downward Triangle Pattern Rows = 13
* * * * * * * * * * * * *
* * * * * * * * * * * *
* * * * * * * * * * *
* * * * * * * * * *
* * * * * * * * *
* * * * * * * *
* * * * * * *
* * * * * *
* * * * *
* * * *
* * *
* *
*
Remaining Shapes of Star Pattern Programs
This section explains the list of available star pattern programs of different kinds of shapes, including the operators, alphabets, etc, with examples.
Christmas Tree Star Pattern
For more information on printing the Python Christmas Tree Star Pattern.
w = int(input("Enter Christmas Tree Width = "))
h = int(input("Enter Christmas Tree Height = "))
sp = w * h
n = 1
for x in range(1, h + 1):
for i in range(n, w + 1):
for j in range(sp, i - 1, -1):
print(end = ' ')
for k in range(1, i + 1):
print('*', end = ' ')
print()
n = n + 2
w = w + 2
for i in range(1, h):
for j in range(sp - 3, -1, -1):
print(end = ' ')
for k in range(1, h):
print('*', end = ' ')
print()
Output
Enter Christmas Tree Width = 5
Enter Christmas Tree Height = 3
*
* *
* * *
* * * *
* * * * *
* * *
* * * *
* * * * *
* * * * * *
* * * * * * *
* * * * *
* * * * * *
* * * * * * *
* * * * * * * *
* * * * * * * * *
* *
* *
Exponentially Increasing Star Pattern
For more information on printing the Python Exponentially Increasing Star Pattern.
import math
rows = int(input("Enter Total Rows : "))
for i in range(rows):
for j in range(1, int(math.pow(2, i) + 1)):
print('*', end = ' ')
print()
Output
Enter Total Rows : 5
*
**
****
********
****************
Plus Star Pattern
For more information on printing the Python Plus Star Pattern.
n = int(input("Enter Plus Pattern Rows = "))
for i in range(1, 2 * n):
for j in range(1, 2 * n):
if i == n or j == n:
print('*', end = '')
else:
print(' ', end = '')
print()
Output
Enter Plus Pattern Rows = 7
*
*
*
*
*
*
*************
*
*
*
*
*
*
H Star Pattern
For more information on printing the H Star Pattern in Python.
def firstLoop(rows, i):
for j in range(1, i + 1):
print('*', end = '')
def secondLoop(rows, i):
for j in range(rows - 1, i - 1, -1):
print('*', end = '')
rows = int(input("Enter H Star Pattern Rows = "))
for i in range(1, rows + 1):
firstLoop(rows, i)
for k in range(i * 2, rows * 2):
print(end = ' ')
firstLoop(rows, i)
print()
for i in range(1, rows):
secondLoop(rows, i)
for k in range(1, i * 2 + 1):
print(end = ' ')
secondLoop(rows, i)
print()
Output
Enter H Star Pattern Rows = 9
* *
** **
*** ***
**** ****
***** *****
****** ******
******* *******
******** ********
******************
******** ********
******* *******
****** ******
***** *****
**** ****
*** ***
** **
* *
V Star Pattern
For more information on printing the V Star Pattern in Python.
n = int(input("Enter V Star Pattern Rows = "))
for i in range(1, n + 1):
for j in range(1, i + 1):
print('*', end = '')
for k in range(1, 2 * (n - i) + 1):
print(end = ' ')
for l in range(1, i + 1):
print('*', end = '')
print()
Output
Enter V Star Pattern Rows = 13
* *
** **
*** ***
**** ****
***** *****
****** ******
******* *******
******** ********
********* *********
********** **********
*********** ***********
************ ************
**************************
Inverted V Star Pattern
For more information on printing the Python Inverted V Star Pattern.
n = int(input("Enter Inverted V Star Pattern Rows = "))
for i in range(n, 0, -1):
for j in range(1, i + 1):
print('*', end = '')
for k in range(1, 2 * (n - i) + 1):
print(end = ' ')
for l in range(1, i + 1):
print('*', end = '')
print()
Output
Enter Inverted V Star Pattern Rows = 12
************************
*********** ***********
********** **********
********* *********
******** ********
******* *******
****** ******
***** *****
**** ****
*** ***
** **
* *
W Star Pattern
For more information on the program to print the Python W Star Pattern.
def Stars(n):
for i in range(n):
print('*', end = '')
def Spaces(n):
for i in range(n):
print(end = ' ')
n = int(input("Enter W Star Pattern Rows = "))
for i in range(n):
Stars(i + 1)
Spaces(n - i - 1)
Stars(n - i + 1)
Spaces(2 * i)
Stars(n - i)
Spaces(n - i - 1)
Stars(i + 1);
print()
Output
Enter W Star Pattern Rows = 12
* ************************* *
** ************ *********** **
*** *********** ********** ***
**** ********** ********* ****
***** ********* ******** *****
****** ******** ******* ******
******* ******* ****** *******
******** ****** ***** ********
********* ***** **** *********
********** **** *** **********
*********** *** ** ***********
************** *************
X Star Pattern
For more information on printing the Python X Star Pattern.
rows = int(input("Enter X Pattern Rows = "))
for i in range(rows):
for j in range(rows):
if(i == j or j == rows - 1 - i):
print('*', end = '')
else:
print(' ', end = '')
print()
Output
Enter X Pattern Rows = 13
* *
* *
* *
* *
* *
* *
*
* *
* *
* *
* *
* *
* *
8 Star Pattern
For more information on printing the Python 8 Star Pattern.
n = int(input("Enter 8 Star Pattern Rows = "))
for i in range(1, n * 2):
if i == 1 or i == n or i == n * 2 - 1:
for j in range(1, n + 1):
if j == 1 or j == n:
print(end = ' ')
else:
print('*', end = '')
else:
for k in range(1, n + 1):
if k == 1 or k == n:
print('*', end = '')
else:
print(end = ' ')
print()
Output
Enter 8 Star Pattern Rows = 10
********
* *
* *
* *
* *
* *
* *
* *
* *
********
* *
* *
* *
* *
* *
* *
* *
* *
********
Left Arrow Star Pattern
For more information on printing the Python Left Arrow Star Pattern.
n = int(input("Enter Left Arrow Pattern Rows = "))
for i in range(1, n + 1):
for j in range(1, n - i + 1):
print(' ', end = '')
for k in range(i, n + 1):
print('*', end = '')
print()
for i in range(1, n):
for j in range(i):
print(' ', end = '')
for k in range(i + 1):
print('*', end = '')
print()
Output
Enter Left Arrow Pattern Rows = 11
***********
**********
*********
********
*******
******
*****
****
***
**
*
**
***
****
*****
******
*******
********
*********
**********
***********
Right Arrow Star Pattern
For more information on the program to print the Python Right Arrow Star Pattern.
n = int(input("Enter Right Arrow Star Pattern Rows = "))
for i in range(n):
for j in range(n):
if j < i:
print(end = ' ')
else:
print('*', end = '')
print()
for i in range(2, n + 1):
for j in range(0, n):
if j < n - i:
print(end = ' ')
else:
print('*', end = '')
print()
Output
Enter Right Arrow Star Pattern Rows = 9
*********
********
*******
******
*****
****
***
**
*
**
***
****
*****
******
*******
********
*********
Star Pattern Programs to Print Alphabets from A to Z
For more information on printing the Python Star pattern of Alphabets from A to Z.