I have array like this:
a=[1,2,3,4,5,6,7]
i need to replace the value of the index 1 , 4 ,5 by the value 10 but without using for loop.
the result:
a=[1,10,3,4,10,10,7]
>Solution :
I guess you could utilize numpy for this:
import numpy as np
a=[1,2,3,4,5,6,7]
indecies = [1, 4, 5]
a = np.array(a)
a.put(indexes, 10)
result:
array([ 1, 10, 3, 4, 10, 10, 7])