Arrow · Pattern
Left Arrow
Left Arrow
ArrowSymbol pattern, solid style, size 5. Changing the rubric, style or size above re-shapes the loops — the structure stays identical while only the printed value or the cell filter changes.
Left Arrow · output
Symbol · Solid · size 5
n = 5
for i in range(2 * n - 1):
for j in range(n):
if n - 1 - min(i, 2 * n - 2 - i) <= j <= n - 1:
print('*', end='')
else:
print(' ', end='')
print()Behind the Scenes Execution
registers · line tracking · call stack · memory regions| Address | Variable | Value |
|---|---|---|
| Stack (4) | ||
| 0x200 | n | 5 |
| 0x204 | i | -1 |
| 0x208 | j | -1 |
| 0x20C | count | 0 |
| String Pool (static) (2) | ||
| 0x400000 | pool["*"] | * |
| 0x400008 | pool["\n"] | \n |
| Heap (9) | ||
| 0x3000 | grid[0] | |
| 0x3020 | grid[1] | |
| 0x3040 | grid[2] | |
| 0x3060 | grid[3] | |
| 0x3080 | grid[4] | |
| 0x30A0 | grid[5] | |
| 0x30C0 | grid[6] | |
| 0x30E0 | grid[7] | |
| 0x3100 | grid[8] | |
Left Arrow
Left-pointing arrow: rows widen A, AB, ABC, …, then narrow again, all aligned to the right like a right-edge triangle that breathes. The value comes from the column count, so the letters grow toward the point.
The size-5 grid
Nine rows confined to 5 columns, right-aligned: widths rise 1, 2, 3, 4, 5 then fall 4, 3, 2, 1, all ending at column 4. The widening middle makes the arrow point left.
Off-by-one traps
The falling half starts at width 4, not 5; repeating 5 gives ten rows and a double-wide middle. The margin must be 5 - width so the block stays flush right.
Step by step
- Loop rows i = 0..2n - 2.
- Width = i + 1 while climbing, then 2n - 1 - i while falling.
- Right-align the block: print n - width leading spaces.
- Print width values (column-count letters), newline per row.
Complexity
When to use it
- Horizontal arrows
- Right-aligned breathing shapes
grid[r] rows in the Heap region and the i / j / count registers on the Stack — every printed character is one write to the grid.Recommended resourcesAffiliate links · may earn us a commission