I want to replace the elements in list at the positions given in replacement indices with new value. For example, if the given list is replace_elements([1,2,3,4,5,6,7,8],[0,4,3],0)
then the outcome should be [0, 2, 3, 0, 0, 6, 7, 8]
. I tried several approaches but none of them seems to work. I tried following code:
for i in new_value:
list_a[i] = replacement_indices
return new_value