Given vector:
a=[6,7,8]
b=a[:]
desired result:
c=somefunction(b)
print(c)
[ 6 6 7 7 8 8]
here is my code that failed: I don't understand why this insert function doesn't update itself.
import numpy as np
def test3(x):
a = x[:]
b=np.array([])
for i in range(0,len(a)):
b=np.insert(a,i,a[i])
return b
z=[8,9,10,11]
f=test3(z)
print(f)
[ 8 9 10 11 11]
Thank you so much for your attention.