So i have been develouping some code to run a simple maths quiz and it did work (to an extent normally) however i have recently made the decision to run it through the easygui module and i keep getting this error, may anyone assist me?
code:
import random
import easygui as a
Class = 0
title = “A453 Arithmatic quiz”
msg = “Welcome to the A453 arythmatic quiz!, what is your name?”
Name = a.enterbox(msg=“Welcome to the maths quiz, what is your name?”,title)
Name = Name
a = a.buttonbox(msg="Hello " + Name + “, what class are you in?”,title=“A453 Arythmatic quiz”,choices=(“Class 1”,“Class 2”,“Class 3”))
if a == “Class 1”:
Class = 1
if a == “Class 2”:
Class = 2
if a == “Class 2”:
Class = 3
def myFunc():
if operators == 1:
answer = num + num2
question = a.integerbox(msg="\nWhat is %s + %s? " % (num,num2),title="",default="",image=None,root=None)
elif operators == 2:
answer = num - num2
question = a.integerbox(msg="\nWhat is %s - %s? " % (num,num2),title="",default="",image=None,root=None)
else:
answer = num * num2
question = a.integerbox(msg="\nWhat is %s * %s? " % (num,num2),title="",default="",image=None,root=None)
if answer == question:
print("Well done!")
return True
else:
print("Sorry, that is incorrect!, the correct answer is %s" % answer)
retrynum = 0
Score = 0
i = 0
while retrynum <= 3:
while i < 10:
num = random.randint(1,10)
num2 = random.randint(1,10)
operators = random.randint(1,3)
correct = myFunc()
if correct == True:
Score +=5
i +=1
retrynum +=1
print(“You final score is %s/10” % Score)
user = Name,Class,Score
retrynum = input("\nYour score is %s, do you wish to retry? " % (Score))
retrynum.upper()