Python Program Print Star Pattern 4

By | July 23, 2019

Python Program Print Star Pattern 4 – This Python programming tutorial explains the source code of the Python print star pattern program # 4.

 **********
  *********
   ********
    *******
     ******
      *****
       ****
        ***
         **
          *
The Source code of Python Program Print Star Pattern 4

The Source code of Python Program Print Star Pattern 4

The Source code of Python Program Print Star Pattern 4

# Write a program to display
# the following star pattern 4
# using nested for loops
#   *****
#    ****
#     ***
#      **
#       *

# Author: www.EasyCodeBook.com (c)

lines = int(input('How many star line in Star Pattern # 4 ?:'))
print('The required star pattern is:')
sp=2
for i in range(lines,0,-1):
    for k in range(1,sp):
        print(' ', end='')
    for j in range(1,i+1):
        print('*', end='')
    print()
    sp+=1

The output of the Star pattern printing Python Program # 4 is:

How many star line in Star Pattern # 4 ?:10
The required star pattern is:
 **********
  *********
   ********
    *******
     ******
      *****
       ****
        ***
         **
          *

Loading

One thought on “Python Program Print Star Pattern 4

  1. Pingback: Python Heart Shape Star Pattern Program | EasyCodeBook.com

Leave a Reply

Your email address will not be published. Required fields are marked *