title: writing function that calculate averge in below list
body: <p>in this list, I want to calculate the average between F &amp; M and save its new list.</p>
  <pre><code>grade = [{'id':1, 'M':20 , &quot;F&quot;:15},
   {'id':2, 'M':14 , &quot;F&quot;:12}, 
   {'id':3, 'M':17 , &quot;F&quot;:18},
   {'id':4, 'M':13 , &quot;F&quot;:17.5}]
  </code></pre>
  <p>the output should be like this</p>
  <pre><code>ave_grade=[{&quot;id&quot;:1 ,&quot;average&quot;:17.5},{&quot;id&quot;:2 ,&quot;average&quot;:13},....]
  </code></pre>
  <p>how could I write a good function?</p>