I need help on the opening up the text file. For some reason it does not seem to be working correctly, and I was wondering if someone could point out any errors and tell me how to solve them. Thanks. 

```
import time
import operator
import random

username=input("What is your name?")

usersClass = input("Which class are you in, 1, 2 or 3?")
print ("Welcome {} to the Math quiz, hope you have fun lets begin".format(username))

start = time.time()

def askquestion():
  score = 0
  opslist = {operator.add: "+", operator.sub: "-", operator.mul: "x"}
  num1,num2 = random.randint(1,10), random.randint(1,10)    
  ops = random.choice(list(opslist.keys()))                       
  ActualAnswer = (ops(num1,num2))                               
  score = 0
  print(num1,opslist[ops],num2)            
  userAns = (int(input("Answer the above")))
  if userAns == ActualAnswer:   
    print("Awesome, that's correct")
    return 1
  else:
    print("Incorrect sorry")
    score = score - 0
  return 0

totalScore = 0
for i in range (10):
  totalScore += askquestion()  

print ("Well done, you have completed the quiz")

print("your final score was " + str(totalScore))
if totalScore > 9:
    print("Great work! You got top marks!")
elif totalScore > 7:
   print("Good, try harder next time and you might get full marks!")
elif totalScore > 5:
    print("You did alright")
elif totalScore > 4:
    print("Are you not motivated.. c'mon")
else:
    print("Hmmm..dissapointing, however know you know what you need to work on")

end = time.time()
etime = end - start
timeTaken = round(etime)

if usersClass == 1:
    with open("class1.txt","a+") as f:
        f.write("{}:Scored {} in {} seconds".format(username,totalScore,timeTaken))

elif usersClass == 2:
    with open("class2.txt","a+") as f:
        f.write("{}:Scored {} in {} seconds".format(username,totalScore,timeTaken))

elif usersClass == 3:
    with open("class3.txt","a+") as f:
        f.write("{}:Scored {} in {} seconds".format(username,totalScore,timeTaken))

```