Python Hourglass Star Pattern (Pattern 75)

Python Code
size = 5
for x in range(size, -(size), -1):
    for y in range(1, abs(x) + 1):
        print(" ", end="")
    for z in range(size, abs(x), -1):
        print("* ", end="")
    print()

Output:

Output of the Python Hourglass Star Pattern pattern
BEGINNER WALKTHROUGH

How the Hourglass Star Pattern works

The star rows widen toward the middle and narrow afterward, with spaces showing the hourglass shape.

01

Build the rows

The outer counter runs through positive and negative values; abs(x) makes the indentation grow again after the center.

02

Choose what each row prints

The star loop uses size and abs(x) as its bounds, so each row gains stars toward the middle and loses them below it.

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.