Shuffle the Array - LeetCode

Given the array nums consisting of 2n elements in the form [x1,x2,...,xn,y1,y2,...,yn].

Return the array in the form [x1,y1,x2,y2,...,xn,yn].

"""
1470. Shuffle the Array

Given the array nums
consisting of 2n elements in the form [x1,x2,...,xn,y1,y2,...,yn].

Return the array in the form [x1,y1,x2,y2,...,xn,yn].

Input: nums = [2,5,1,3,4,7], n = 3
Output: [2,3,5,4,1,7] 
"""

nums = [2,5,1,3,4,7]
n = 3
count = 1
print(nums)

i = 0
while i < n - 1:
    num = nums.pop(n+i)
    nums.insert(count, num)
    
    i += 1
    count += 2

print(nums)