Python Star Pattern Program 1

By | July 23, 2019

Python Star Pattern Program 1 – This Python programming tutorial explains the Python code to display a star pattern on the screen.

Python Star Pattern Program 1

Python Star Pattern Program 1

Python Star Pattern Program 1

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

# Author: www.EasyCodeBook.com (c)

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

The output of The Star Pattern program 1 in Python

How many star lines in Star Pattern?:5
The required star pattern is:
*
**
***
****
*****

Loading

Leave a Reply

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