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 Numbers and Alphabetical articles so that you can understand them better. Please refer to the Python language to understand the syntax and the loops.
Python Star Pattern Programs
The following are the Python 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 Diamond Pattern of Stars -> Click Here!
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 Hollow Diamond Star Pattern -> Click Here!
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 Half Diamond Star Pattern -> Click Here!
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 Hollow Half Diamond Star Pattern -> Click Here!
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 -> Click Here!
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 Hollow Mirrored Half Diamond Star Pattern -> Click Here!
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 Diamond inside a Square Star Pattern -> Click Here!
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 Left Pascals Star Triangle Star Pattern -> Click Here!
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 Hollow Left Pascals Triangle Star Pattern -> Click Here!
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 Right Pascals Triangle Star Pattern -> Click Here!
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 Hollow Right Pascals Triangle Star Pattern -> Click Here!
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 Pyramid Star Pattern -> Click Here!
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 Python program to print the Hollow Pyramid Star Pattern -> Click Here!
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 Inverted Pyramid Star Pattern -> Click Here!
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 Hollow Inverted Pyramid Star Pattern -> Click Here!
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
* * * * * * * * * * * *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
*
Python 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 Rectangle Star Pattern -> Click Here!
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 Hollow Rectangle Star Pattern -> Click Here!
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 Rhombus Star Pattern -> Click Here!
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 Hollow Rhombus Star Pattern -> Click Here!
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 Mirrored Rhombus Star Pattern -> Click Here!
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 Hollow Mirrored Rhombus Star Pattern -> Click Here!
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 Right Angled Triangle Star Pattern -> Click Here!
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 Hollow Right Triangle Star Pattern -> Click Here!
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 Inverted Right Triangle Star Pattern -> Click Here!
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 Hollow Inverted Right Triangle Star Pattern-> Click Here!
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 Mirrored Right Triangle Star Pattern -> Click Here!
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 Python program to print the Reverse or Inverted Mirrored Right Triangle Star Pattern -> Click Here!
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 Hollow Mirrored Right Triangle Star Pattern -> Click Here!
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 -> Click Here!
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 Square Star Pattern -> Click Here!
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 Hollow Square Star Pattern -> Click Here!
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 Hollow Square With Diagonals Star Pattern -> Click Here!
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 Sandglass Star Pattern -> Click Here!
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 Hollow Sandglass Star Pattern -> Click Here!
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 Triangle Star Pattern -> Click Here!
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 Hollow Triangle Star Pattern -> Click Here!
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 -> Click Here!
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 -> Click Here!
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 Downward Triangle Star Pattern -> Click Here!
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 C 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 Christmas Tree Star Pattern -> Click Here!
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 Exponentially Increasing Star Pattern -> Click Here!
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 Plus Star Pattern -> Click Here!
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 -> Click Here!
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 -> Click Here!
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 Inverted V Star Pattern -> Click Here!
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 Python program to print the W Star Pattern -> Click Here!
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 X Star Pattern -> Click Here!
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 8 Star Pattern -> Click Here!
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 Left Arrow Star Pattern -> Click Here!
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 Python program to print the Right Arrow Star Pattern -> Click Here!
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
*********
********
*******
******
*****
****
***
**
*
**
***
****
*****
******
*******
********
*********
Python Star Pattern Programs to Print Alphabets from A to Z
For more information on printing the Star pattern of Alphabets from A to Z >> ClickHere!