Arrow · Pattern
Double Arrow ←→
Double 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.
Double Arrow ←→ · output
Symbol · Solid · size 5
n = 5
for i in range(2 * n):
for j in range(n):
if j <= i or j >= n - 1 - i:
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 (10) | ||
| 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] | |
| 0x3120 | grid[9] | |
Double Arrow ←→
A two-headed horizontal arrow: two breathing triangles, one pointing left and one pointing right, sharing the same rows. Two widths computed together decide each cell.
The size-5 grid
Ten rows across 9 columns: each row paints a left block of width r + 1 and a mirrored right block of the same width, so the gap shrinks from 7 to 1 and the two heads meet in the middle at row 4.
Off-by-one traps
The gap is 9 - 2w and must stay non-negative; computing the right block as columns 9 - w to 8 is correct, while 9 - w + 1 to 9 leaves a one-column hole at the edge.
Step by step
- Loop rows i = 0..2n - 1.
- Right arrow part: width = min(i, 2n - 1 - i) + 1 on the left.
- Left arrow part: mirrored width on the right side.
- Print both blocks on the same line, then newline.
Complexity
When to use it
- Double-headed arrows
- Two blocks per row
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