Generate left triangle star pattern using nested loop

Here, We are going to generate left triangle star pattern in python using nested loop. We use outer loop to run for n times and inner loop to run for i times to print left triangle star pattern.

Left triangle star pattern using nested for loop

# Left triangle star pattern
n = 5

for i in range(1, n+1):
    # internal loop run for i times
    for j in range(1, i+1):
        print("*", end="")
    print()

Output

*
**
***
****
*****
<