Python Program to Print Left Pascals Star Triangle

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

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

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

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

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

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

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

print("====Left Pascals Star Triangle Pattern====")
i = 1
while(i <= rows):

    j = i
    while(j < rows):
        print(end = '  ')
        j = j + 1

    l = 1
    while(l <= i):
        print('*', end = ' ')
        l = l + 1
    print()
    i = i + 1

i = rows
while(i >= 1):
    j = i
    while(j <= rows):
        print(end = '  ')
        j = j + 1

    l = 1
    while(l < i):
        print('*', end = ' ')
        l = l + 1
    print()
    i = i - 1
Enter Left Pascals Star Triangle Pattern Rows = 7
====Left Pascals Star Triangle Pattern====
            * 
          * * 
        * * * 
      * * * * 
    * * * * * 
  * * * * * * 
* * * * * * * 
  * * * * * * 
    * * * * * 
      * * * * 
        * * * 
          * * 
            * 

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

def pyLeftPascalsStar(rows, ch):
    for i in range(1, rows + 1):
        for l in range(i, rows):
            print(end = '  ')
        for m in range(1, i + 1):
            print('%c' %ch, end = ' ')  
        print()

    for i in range(rows, 0, -1):
        for l in range(i, rows + 1):
            print(end = '  ')
        for m in range(1, i):
            print('%c' %ch, end = ' ')  
        print()

rows = int(input("Enter Left Pascals Star Triangle Pattern Rows = "))
ch = input("Symbol to use in Sandglass Pattern = " )

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