Python Star Pattern Row 1 to 5 Triangle

By | March 18, 2020

Python Star Pattern Row 1 to 5 Triangle

Python Star Pattern Row 1 to 5 Triangle

Python Star Pattern Row 1 to 5 Triangle

# Write a Python program
# using nested for loops to print the
# following one star to n stars pattern
# per row.

#   *
#   **
#   ***
#   ****
#   *****


# 
# Perfect Python Programming Tutorials
# Author : www.EasyCodebook.com (c)



# i for rows 1 to 5
# j for columns 1 to i

# Actual Program starts here 

# Python Program - Star Pattern Program No. 1

rows = 5		
for i in range(1,rows+1):
    for j in range(1,i+1):
        print('* ',end='')
    print()

Output

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

Loading

Leave a Reply

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