I am trying to create two subarrays in given order, in this case i have two integers a and b a
represents the value of the subarrays range, and b
represents how many times it needs to be rotated.
I created the subarrays like this;
def reorder(a,b):
return [[i for i in range(0, a//2)]] + [[f for f in range(a//2, a)]]
Imagine a
is 10 and b
is 1 the output is:
[[0, 1, 2, 3, 4], [5, 6, 7, 8, 9]]
But how can i reverse each subarrays b
times?
The output that i want;
[[4, 0, 1, 2, 3], [9, 5, 6, 7, 8]]