title: A453 Task 3 Programming
body: <p>I am currently studying computer science as a GCSE student. Me and my teacher are struggling with task 3. The requirements of the task are: 
  It then needs to ask the user what class they would like to view<br>
  After this it will need to ask if they would like to view the file sorted    alphabetically, the high scores of the particular class or if they would like to view the average of each student in the selected class  </p>
  
  <pre><code>import csv  
  print("1 for Class A\n2 for Class B\n3 for Class C")  
  choosen=int(input())  
  class_a = open('class_a.csv')  
  class_b = open('class_b.txt')  
  class_c = open('class_c.txt')  
  if choosen == 1:  
   print("1 for for alphabetical orderwith each students highest score\n2 for highest score, highest to lowest\n3 for average score, highest to lowest")  
      cho_two=int(input())  
      csv_a = csv.reader(class_a)  
      a_list = []  
      for row in csv_a:  
          row[1] = int(row[1])  
          row[2] = int(row[2])  
          row[3] = int(row[4])  
          minimum = min(row[1:2])  
          row.append(minimum)  
          maximum = max(row[1:2])  
          row.append(maximum)  
          average = sum(row[1:2])//3  
          row.append(average)  
          a_list.append(row[0:9])  
      if cho_two == 1:  
          alphabetical = [[x[0],x[6]] for x in a_list]  
          print("\nCLASS A\nEach students highest by alphabetical order \n")  
          for alpha_order in sorted(alphabetical):  
              print(alpha_order)  
              class_a.close()  
      elif cho_two == 2:  
          print("\nCLASS A\nThe highest score to the lowest \n")  
          for high_scr in sorted(highest_score,reverse = True):  
              print(high_scr)  
              class_a.close()             
      elif cho_two == 3:  
          average_score = [[x[8],x[0]] for x in a_list]  
          print("\nCLASS A\nThe average score from highest to lowest \n")  
          for ave_scr in sorted(average_score,reverse = True):  
              print(ave_scr)  
              class_a.close()  
  </code></pre>
  
  <p>My code when run in python tells me there is a problem on line 13 with "index out of range"</p>
  
  <p>My text file contains:<br>
  Roo,2,3,<br>
  Roo,4,4,<br>
  Alfie,5,8,<br>
  Alfie,2,8,<br>
  Bob,2,8,<br>
  Connor,3,5,<br>
  Connor,5,3,<br>
  Ellis,5,6,<br>
  George,5,4,<br>
  Ellis,4,9,<br>
  Nathan,5,6,<br>
  George,5,5,<br>
  Alfie,9,4,<br>
  George,4,7,<br>
  Celis,4,5,<br>
  Leo,3,2,<br>
  Celis,6,1,<br>
  Leo,5,2,  </p>
  
  <p>When I run the program the code, row<a href="http://i.stack.imgur.com/AVIdz.png" rel="nofollow">1</a> = into(row<a href="http://i.stack.imgur.com/AVIdz.png" rel="nofollow">1</a>) tells me it's out of range? Any solutions?</p>