Python Program to Print Right Pascals Star Triangle

Write a Python program to print the right pascals star triangle using for loop. 

rows = int(input("Enter Right Pascals Star Triangle Pattern Rows = "))

print("====Right Pascals Star Triangle Pattern====")

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

for i in range(rows - 1, -1, -1):
    for j in range(0, i):
        print('*', end = ' ')
    print()
Python Program to Print Right Pascals Star Triangle

This Python program prints the right pascals star triangle using a while loop.

rows = int(input("Enter Right Pascals Star Triangle Pattern Rows = "))

print("====Right Pascals Star Triangle Pattern====")
i = 0
while(i < rows):
    j = 0
    while(j <= i):
        print('*', end = ' ')
        j = j + 1
    print()
    i = i + 1

i = rows - 1
while(i >= 0):
    j = 0
    while(j <= i - 1):
        print('*', end = ' ')
        j = j + 1
    print()
    i = i - 1
Enter Right Pascals Star Triangle Pattern Rows = 7
====Right Pascals Star Triangle Pattern====
* 
* * 
* * * 
* * * * 
* * * * * 
* * * * * * 
* * * * * * * 
* * * * * * 
* * * * * 
* * * * 
* * * 
* * 
* 

In this Python example, we used the pyRightPascalStar function to display the right pascals triangle pattern of a given character.

def pyRightPascalsStarTriangle(rows, ch):
    for i in range(0, rows):
        for j in range(0, i + 1):
            print('%c' %ch, end = ' ')
        print()

    for i in range(rows - 1, -1, -1):
        for j in range(0, i):
            print('%c' %ch, end = ' ')
        print()
    
rows = int(input("Enter Right Pascals Star Triangle Pattern Rows = "))

ch = input("Symbol to use in Right Pascals Star Triangle Pattern = " )

print("====Right Pascals Star Triangle Pattern====")
pyRightPascalsStarTriangle(rows, ch)
Enter Right Pascals Star Triangle Pattern Rows = 10
Symbol to use in Right Pascals Star Triangle Pattern = $
====Right Pascals Star Triangle Pattern====
$ 
$ $ 
$ $ $ 
$ $ $ $ 
$ $ $ $ $ 
$ $ $ $ $ $ 
$ $ $ $ $ $ $ 
$ $ $ $ $ $ $ $ 
$ $ $ $ $ $ $ $ $ 
$ $ $ $ $ $ $ $ $ $ 
$ $ $ $ $ $ $ $ $ 
$ $ $ $ $ $ $ $ 
$ $ $ $ $ $ $ 
$ $ $ $ $ $ 
$ $ $ $ $ 
$ $ $ $ 
$ $ $ 
$ $ 
$