python 3.x - Last Element in For Loop Not Iterating Completely -


i'm having issue 1 of assignments i'm using loop compare 2 lists, 1 being answer key, , other being list of student answers, produce score +4 given correct responses, -1 incorrect, , 0 omitted responses. it's working fine until gets last element of loop. know program "reading" last elements, because i've had print them before, it's not adjusting score correctly, , subtracting point, regardless of answer. can't figure out what's going wrong, since it's last part this.

here relevant part of code:

    #as go on each line, add student counter keep track of number of students.     #we use split function turn each line of file list can use.     line in open_file:         students += 1         student_ans = line.split(",")          #the score tracker keeps track of total score.         score_tracker = 0          #this loop iterates on each value in list, comparing answer key.         n in range(number_ans):             = answerkey[n]             b = student_ans[n+1]              #a series of if/elif/else statements give , take points according answers.             if == b:                 score_tracker += 4             elif b == "":                 score_tracker += 0             else:                  score_tracker -= 1         print(score_tracker) 

any appreciated.

between me , professor, we've figured out wrong. turns out last element in each line of file contained "\n" bring new line, , hadn't thought rid of because didn't stop code printing out 2 correct answers, correctly adding score. (the computer saw d , dn\, showed me d , d final answers on answer key.

i suppose lesson in me @ computer sees, not see.