Python Program Print Star Pattern 5

By | July 23, 2019

Python Program Print Star Pattern 5 – This Python programming tutorial provides the Python code for the Python Program Print Star Pattern 5 and the output of a sample run of the program.

Python Program Print Star Pattern 5

Python Program Print Star Pattern 5

Python Program Print Star Pattern 5

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

# Author: www.EasyCodeBook.com (c)

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

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

The output of the Python Star pattern 5 Program

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

Leave a Reply

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