Python Program Print Star Pattern 6

By | July 23, 2019

Python Program Print Star Pattern 6 – This Python Programming Tutorial will explain the Python program to print the star pattern number 6 as shown in the following figure:

Python Program Print Star Pattern 6

Python Program Print Star Pattern 6

The Source Code of Python Program to Print Star Pattern 6

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

# Author: www.EasyCodeBook.com (c)

lines = int(input('How many star line in Star Pattern # 6 ?:'))
print('The required star pattern is:')

for i in range(lines,0,-1):
    for k in range(lines,i,-1):
        print(' ', end='')
    for j in range(1,i*2):
        print('*', end='')
    print()
    

The output of the Python program to display star pattern No. 6

How many star line in Star Pattern # 6 ?:5
The required star pattern is:
*********
 *******
  *****
   ***
    *

Loading

Leave a Reply

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