<!DOCTYPE html>
Python Program to Print Hollow Left Pascal’s Star Triangle
This program prints a hollow left Pascal’s star triangle using Python.
def print_triangle(n): for i in range(n): for j in range(n): if i == j or j == 0: print("*", end="") elif i==n-1: print("*", end="") else: print(" ", end="") print() n = 5 print_triangle(n)
Output:
* ** * * * * *****
This program uses nested loops to iterate through each row and column of the triangle. It prints a star if the conditions are met, otherwise it prints a space. The triangle is hollow on the left side and forms a Pascal’s triangle pattern.
Feel free to run this program in your Python environment and experiment with different values of n to generate different triangle patterns.