Question: write a python code You are given some array called ar1 that contains (2 * n) elements in the arrangement of [x 1, x 2

write a python code

You are given some array called ar1 that contains (2 * n) elements in the arrangement of [x1, x2,,xn,y1,y2,yn] where length of ar1 is == to (2*n)

Create a program that will return the array in the following form of: [x1,y1,x2,y2,,xn,yn] , you may use a function but is not mandatory.

Sample example 1:

User input: [1,2,3,4,4,3,2,1] and n = 4

Output: [1,4,2,3,3,2,4,1]

Sample example 2:

User input: [3,3,4,4] and n = 2

Output: [3,4,3,4]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!