We're a place where coders share, stay up-to-date and grow their careers.

Python (golfing, and assuming we want to mutate the input list)

def f(x):x[:]=[x[i+i%2*len(x)>>1]for i in range(len(x))]

The idea is to use as index

(i // 2) + (((i % 2) * len(x)) // 2)

We can however factor //2 so we get

//2

(i + (i % 2) * len(x)) // 2

Then we can use right shift >> to get rid of parenthesis to the final

>>

i + i % 2 * len(x) >> 1

A solution just returning the shuffled array instead could be:

f=lambda x:[x[i+i%2*len(x)>>1]for i in range(len(x))]

Python (golfing, and assuming we want to mutate the input list)

The idea is to use as index

We can however factor

`//2`

so we getThen we can use right shift

`>>`

to get rid of parenthesis to the finalA solution just returning the shuffled array instead could be: