Python Program Print Star Pattern 3

By | July 23, 2019

Python Program Print Start Pattern 3 – This Python tutorial explains the Python source code of Python Program Print Start Pattern 3.

     *
    **
   ***
  ****
 *****
Python Program Print Start Pattern 3

Python Program Print Start Pattern 3

The Source code of Python Program Print Start Pattern 3

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

# Author: www.EasyCodeBook.com (c)

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

The output of Python Program Print Start Pattern 3

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

    *
   **
  ***
 ****
*****

Loading

Leave a Reply

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