title: Max average of two dictionaries values in a list Python
body: <p>So this is my list of dictionaries:</p>
  <pre><code>array_of_dictionaries = [{
      &quot;name&quot;: &quot;Budi&quot;,
      &quot;age&quot;: 23,
      &quot;test_scores&quot;: [100.0, 98.0, 89.0]
  },
  {
      &quot;name&quot;: &quot;Charlie&quot;,
      &quot;age&quot;: 24,
      &quot;test_scores&quot;: [90.0, 100.0]
  }]
  
  </code></pre>
  <p>And this is my code:</p>
  <pre><code>def get_all_time_max_avg_score(dictionary_list):
    for element in dictionary_list:
      lensum = len(element['test_scores'])
      elesum = sum(element['test_scores'])
      meansum = elesum / lensum
      for attribute in element.keys():
          print(&quot;Mr. &quot; + str(element['name']) + &quot; with age(years) &quot; + str(element['age']) + &quot; get the highest average scores, &quot; + str(round(meansum, 2)))
          break
  get_all_time_max_avg_score(array_of_dictionaries)
  </code></pre>
  <p>So I want to get the highest average scores from both of that dictionaries. The output I desired is:</p>
  <pre><code>Mr. Budi with age(years) 23 get the highest average scores, 95.67
  </code></pre>
  <p>But what I get is:</p>
  <pre><code>Mr. Budi with age(years) 23 get the highest average scores, 95.67
  Mr. Charlie with age(years) 24 get the highest average scores, 95.0
  </code></pre>
  <p>I really appreciate every help I can get.</p>