0
array0 = [1,2,3] array1 = ['a','b','c']
having the two arrays above, as return this value that is below?
//[1,'a',2,'b',3,'c']
0
array0 = [1,2,3] array1 = ['a','b','c']
having the two arrays above, as return this value that is below?
//[1,'a',2,'b',3,'c']
0
One way is to initialize the resulting array as empty and append each element of the initial arrays alternately.
array0 = [1,2,3]
array1 = ['a','b','c']
array2 = []
for i in range(3):
array2.append(array0[i])
array2.append(array1[i])
print(array2)
Note that this solution does not treat arrays of different sizes.
Browser other questions tagged python array
You are not signed in. Login or sign up in order to post.
Although the title of the question suggested above as duplicate is different, the reply that you have there serves for your case also
– hkotsubo