I have a list like this
x = [4342, 318, 262, 6827, 314, 765, 11525, 67, 654, 13]
And I want to take mean of 11525,67 and 654, and then put it at the index of 11525.
So, basically I want my list x to be like this :-
x = [4342, 318, 262, 6827, 314, 765, 4082, 13]
I know how to take the average but do not know about how can I modify the list by deleting the indices. This is what I've done so far
sum = 0
count = 0
for x in range(6, 9):
sum += text_index[x]
count += 1
print(sum, count)
avg = int(sum/count)
print(avg)
Now, how should I edit my list to get the desired output?