title: unexpected EOF while parsing
body: <p>I working on a program that recalls data from various text files and displays it in a variety of user chosen ways. I'm not very familiar with Python and there are probably a lot of errors in my code. When I run the code I get an <code>unexepected EOF while parsing</code> error. Does anybody know what is wrong here?</p>
  
  <pre><code>from time import sleep
  import sys
  
  for i in range(21):
      sys.stdout.write('\r')
      sys.stdout.write("[%-20s] %d%%" % ('='*i, 5*i))
      sys.stdout.flush()
      sleep(0.25)
  
  print('\nWelcome to The Arithmatic Quiz: Teacher Eddition.')
  
  UserName = input('Please input your user name and press enter.')
  
  if UserName == 'MrSmith':
      print ('Please proceed.')
  
  else:
      quit()
  
  Password = input('Please input your password and press enter.')
  
  if Password == 'Maths':
      print ('Welcome Mr Smith.')
  
  else:
      quit()
  
  import csv
  import operator
  
  classdata = 0
  while classdata == 0:
  
      Class = input ('Which class do you want the data for?')
  
      Display = input ('How do you want the data t be sorted? Alphabetically      (A), on highest score for the first try (H1), on highest score for the second try (H2), on highest score for the third try (H3), or average score (Avg)?')
  
  if Class == '1':
      Class_1 = open('class_1.txt','r')
  
      csv1 = csv.reader(Class_1,delimiter=',')
  
      if Display == 'A':
          sortA = sorted(csv1,key=operator.itemgetter(1))
  
          for eachline in sortA:
              print (eachline)
  
      if Display == 'H1':
          sortB = sorted(csv1,key=operator.itemgetter(2))
  
          for eachline in sortB:
              print (eachline)
  
      if Display == 'H12':
          sortB = sorted(csv1,key=operator.itemgetter(3))
  
          for eachline in sortB:
              print (eachline)
  
      if Display == 'H3':
          sortB = sorted(csv1,key=operator.itemgetter(4))
  
          for eachline in sortB:
              print (eachline)
  
      elif Display == 'Avg':
          sortC = sorted(csv1,key=operator.itemgetter(5))
  
          import csv
          from collections import Counter
  
          def average_column (csv_filepath):
              row_totals = Counter()
              with open('Class_1',"rb") as f:
                  reader = csv.reader(f)
                  column_count = 0.0
                  for column in reader:
                      for row_idx, row_value in enumerate(column):
                          try:
                              n = float(row_value)
                              row_totals(row_idx) += n
                              column_count += 1.0
                              column_count -= 1.0
                              row_indexes = row_totals.keys()
                              row_indexes.sort()
                              averages = (row_totals(idx)/column_count for idx in row_indexes)
                              print(averages)
  </code></pre>
  
  <p>If it helps, I'm running Python 3.4.3</p>