I've been tasked with making a Quiz app for a school project. It's meant to ask the user how many questions they want, and they then enter all of the Q&A's. Once finished, someone will then take the test.
The problem is, I'm getting an IndexError from the results function. This function is supposed to compare the test answers with the user's answers and print out a score.
def results(testAnswers, userAnswers):
score = 0
for i in range(0, len(answers)):
if testAnswers[i].lower().strip() == userAnswers[i].lower().strip():
score += 1
print("\nResults: You got " + str(score) + " out of " + str(len(answers)) + "!")
Does anyone know how I can fix this problem?