original_docstring:  take in original csv and create honour roll, plist, and GE roll
docstring: take in original csv and create honour roll, plist, and GE roll
docstring_tokens: take in original csv and create honour roll plist and GE roll
code: def roll_convert(csvfile, excluded_courses):
      """ take in original csv and create honour roll, plist, and GE roll"""
      reader = csv.DictReader(csvfile, delimiter=",", quotechar="\"")
  
      last_student = ""
      students = []
      for row in reader:
          # courses not from pg count for nothing
          if row["School Name"] != "Point Grey Secondary":
              continue
  
          # get student object or create if missing
          if row["Student Number"] == last_student:
              student = students[-1]
          else:
              student = Student(row)
              students.append(student)
              last_student = row["Student Number"]
  
          student.GE = student.GE and row["Study Habit"] in ["G", "E", ""]
  
          # don't include course if it's in the excluded list
          if any([exclude in row["Course Code"] for exclude in excluded_courses]):
              continue
  
          if not row["Mark"].isnumeric():
              continue
          # create a student object with a list of all courses of that student
          student.courses.append(row)
  
      # go through all students for honour and plist
      for student in students:
          # loop through courses and calculate average
          average = 0
          for course in student.courses:
              average += int(course["Mark"])
              if int(course["Mark"]) < 60:
                  student.term_null = True
  
          if student.courses:
              average /= len(student.courses)
          student.average = average
  
          # mark null if less than 6 courses
          if len(student.courses) < 6:
              student.term_null = True
  
          if student.number == "773090":
              print(len(student.courses), student.term_null)
  
      plists = []
      for g in range(8, 13):
          top = [s for s in students if int(s.grade) == g]
          tenth = ceil(len(top)/10)
  
          top = [s for s in top if not s.term_null] # remove null students
          top.sort(key=lambda s: s.average)  # sort by average
          top = list(reversed(top))[:tenth]  # take the top ten percent
  
          cutoff = top[-1].average
          plists.append((g, cutoff))
  
      return plists, students
code_tokens: def roll_convert ( csvfile , excluded_courses ) : reader = csv . DictReader ( csvfile , delimiter = "," , quotechar = "\"" ) last_student = "" students = [ ] for row in reader : if row [ "School Name" ] != "Point Grey Secondary" : continue if row [ "Student Number" ] == last_student : student = students [ - 1 ] else : student = Student ( row ) students . append ( student ) last_student = row [ "Student Number" ] student . GE = student . GE and row [ "Study Habit" ] in [ "G" , "E" , "" ] if any ( [ exclude in row [ "Course Code" ] for exclude in excluded_courses ] ) : continue if not row [ "Mark" ] . isnumeric ( ) : continue student . courses . append ( row ) for student in students : average = 0 for course in student . courses : average += int ( course [ "Mark" ] ) if int ( course [ "Mark" ] ) < 60 : student . term_null = True if student . courses : average /= len ( student . courses ) student . average = average if len ( student . courses ) < 6 : student . term_null = True if student . number == "773090" : print ( len ( student . courses ) , student . term_null ) plists = [ ] for g in range ( 8 , 13 ) : top = [ s for s in students if int ( s . grade ) == g ] tenth = ceil ( len ( top ) / 10 ) top = [ s for s in top if not s . term_null ] top . sort ( key = lambda s : s . average ) top = list ( reversed ( top ) ) [ : tenth ] cutoff = top [ - 1 ] . average plists . append ( ( g , cutoff ) ) return plists , students
short_docstring: take in original csv and create honour roll, plist, and GE roll
short_docstring_tokens: take in original csv and create honour roll plist and GE roll
comment: """ take in original csv and create honour roll, plist, and GE roll"""$SEP$# courses not from pg count for nothing$SEP$# get student object or create if missing$SEP$# don't include course if it's in the excluded list$SEP$# create a student object with a list of all courses of that student$SEP$# go through all students for honour and plist$SEP$# loop through courses and calculate average$SEP$# mark null if less than 6 courses$SEP$# remove null students$SEP$# sort by average$SEP$# take the top ten percent