title: PYTHON: Finding the average of values of a nested list
body: <p>I have a list: </p>
  
  <pre><code>    data=[ [["apple",2]], [["cake",5],["cake",8]], [["chocolate",3],["chocolate",9],["chocolate",10]],[["grapes",6]] ]
  </code></pre>
  
  <p>This list (data) consists of lists (data[x]), which consists of lists (data[x][x]) containing the same word together, each with a number with it. I want to find the average of the number for each word (any floats rounded to integer). </p>
  
  <p>For example, there are 2 cakes in the list (data[1]) and in the same list are the numbers 5 and 8. I want the average out of those two numbers, which would be 7, and so data[1] would be changed to ["cake",7]</p>
  
  <p>If this is done for each element in the list, the result should be: </p>
  
  <pre><code>    data=[["apple",2],["cake",7],["chocolate",7],["grapes",6]]
  </code></pre>
  
  <p>How could this be done? Thanks :3</p>