title: Reading a CSV file, calculating averages and printing said averages
body: <p>I have been assigned a task to create a quiz for primary school members. I have nailed every single task but this one.</p>
  
  <p>I have to calculate the scores in the CSV file by:
  • in alphabetical order with each student’s highest score for the tests
  • by the highest score, highest to lowest
  • by the average score, highest to lowest.</p>
  
  <p>Here's the code I have so far. It doesn't seem to calculate the averages, even though I have followed the PowerPoint effectively. Everything in the PowerPoint is in the code.</p>
  
  <p>Here's what I have so far:</p>
  
  <pre><code>import csv
  
  results = open("Scores1.csv", "r+")
  csv1 = csv.reader(results, delimiter=",")
  
  
  data = []
  
  for eachline in csv1:
      print(eachline)
      eachline[1] = int(eachline[1])
      eachline[2] = int(eachline[2])
      eachline[3] = int(eachline[3])
      highscore = max(eachline[1:4])
      eachline.append(highscore)
      average = round(sum(eachline[1:4])/3)
      eachline.append(average)
      data.append(eachline)
  
  print(data)
  </code></pre>
  
  <p>The error I get is:</p>
  
  <pre><code>Traceback (most recent call last):
    File "Z:\My Work\Year 11\Computing\A453 Programming Project\PythonFiles\scores.py", line 17, in &lt;module&gt;
      eachline[1] = int(eachline[1])
  IndexError: list index out of range
  </code></pre>
  
  <p>I don't understand the error being given to me, as everything in the CSV file looks fine.
  I aren't the best at it, and would like a simple answer please so I can understand it effectively and learn from it.</p>
  
  <p>Many thanks.</p>