title: Calculating the final grade from tests
body: <pre><code>Lloyd = {
      "name":"Lloyd",
      "homework": [90,97,75,92],
      "quizzes": [ 88,40,94],
      "tests": [ 75,90]
      }
  Alice = {
      "name":"Alice",
      "homework": [100,92,98,100],
      "quizzes": [82,83,91],
      "tests": [89,97]
      }
  Tyler = {
      "name":"Tyler",
      "homework": [0,87,75,22],
      "quizzes": [0,75,78],
      "tests": [100,100]
      }
  
  def average(value):
      avg=0
      items = len(value)
      for item in value:
          avg +=item 
      return avg/items
  
  def getAverage(dictin):
      hw = average(dictin.get('homework'))
      quiz = average(dictin.get('quizzes'))
      tests = average(dictin.get('tests'))
      weighted_average = hw*.1 + quiz*.3 + tests*.6
      return weighted_average
  
  def getLetterGrade(score):
      if score &gt;=90:
          return "A"
      elif score &lt; 90 and score &gt;= 80:
          return "B"
      elif score &lt; 80 and score &gt;= 70:
          return "C"
      elif score &lt; 70 and score &gt;= 60:
          return "D"
      elif score &lt; 60:
          return "F"
      else:
          return "No grades for you"
  
  score = getAverage(Lloyd)
  grade = getLetterGrade(score)
  print grade
  </code></pre>
  
  <p>This works fine but I am told that in the case of the score being 89.5, it would not work.  I tried that as well but I am not able to find out where the problem could be.  Any mistakes are welcome.</p>