title: Finding mean of a part of list in python and then modifying the list
body: <p>I have a list like this </p>
  
  <pre><code>x = [4342, 318, 262, 6827, 314, 765, 11525, 67, 654, 13]
  </code></pre>
  
  <p><br>And I want to take <code>mean of 11525,67 and 654</code>, and then put it at the index of 11525. 
  So, basically I want my list x to be like this :-</p>
  
  <pre><code>x = [4342, 318, 262, 6827, 314, 765, 4082, 13]
  </code></pre>
  
  <p>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 </p>
  
  <pre><code>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)
  </code></pre>
  
  <p>Now, how should I edit my list to get the desired output? </p>