title: Error: list indices must be integers not float
body: <p>The code following should take the list of marks from the dictionary of a student and calculate the average marks of the student. I am getting the "TypeError: list indices must be integers, not float" error.</p>
  
  <pre><code>alice = {
      "name": "Alice",
      "homework": [100.0, 92.0, 98.0, 100.0],
      "quizzes": [82.0, 83.0, 91.0],
      "tests": [89.0, 97.0]
  }
  
  # Averege function is given below for calculating avg
  def average(lst):
      l=float(len(lst))
      total = 0.0
      #code works till here the error occoured below
      for item in lst:
          add = int(lst[item])
          print add
          total+=add
      return total//l
  
  print average(alice['tests'])
  print alice['tests']
  </code></pre>