Skip to main content

Positional Array Transformation Alogrithm

Python

Generating new arrays by interleaving values from previously generated arrays according to directional rules.

Python
Python · 15 lines
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
def render(array):
    forward = array
    reverse = array[::-1]

    print("Forward:", forward)
    print("Reverse:", reverse)

    down_4 = [
        forward[1],
        reverse[1],
        forward[0],
        reverse[0]
    ]

    print("Down 4:", down_4)
0 Fire 0 Learned something 0 Saved me time 0 Mind-blown
Sign in to react and star
Share WhatsApp Post LinkedIn