CORRECT_ANSWERS = ["A" , "C" , "A" , "A" , "D" , "B" , "C" , "A" , "C" , "B" , "A" , "D" , "C" , "A" , "D" , "C" , "B" , "B" , "D" , "A"] student_answers = ["A" , "C" , "A" , "A" , "A" , "B" , "C" , "A" , "C" , "C" , "A" , "D" , "C" , "A" , "A" , "C" , "B" , "B" , "D" , "D"] #student_file = open("test.txt" , "r") #for line in student_file: # student_answers.append(line.rstrip('\n')) #student_file.close() correct_answers = 0 index_position = 0 for index in range(len(CORRECT_ANSWERS)): if CORRECT_ANSWERS[index_position] == student_answers[index_position]: correct_answers += 1 index_position += 1 print(correct_answers)This works.
I still have more to do with it but I should be able to figure it out. The for loop condition was what was really confusing me. Thank you. These things happen when trying to work ahead of the class strictly from a book.