Python Left-Aligned Star Triangle (Pattern 10)

Python Code
for x in range(1, 6):
    for y in range(1, x + 1):
        print("*", end="")
    print()

Output:

Output of the Python Left-Aligned Star Triangle pattern
BEGINNER WALKTHROUGH

How the Left-Aligned Star Triangle works

The star rows grow from one star to five, forming a simple increasing triangle.

01

Build the rows

The outer loop uses x from 1 to 5, so x also represents the number of stars required on the current row.

02

Choose what each row prints

The inner loop runs x times and prints one star each time; its length grows with every outer-loop pass.

03

Keep the output aligned

The inner print calls use end="" to keep values on the same line. The final empty print() moves to the next row.