This is the code so far, me with the help of a few very helpful people have done this so far:
def myFunc():
if operators == 1:
answer = num + num2
question = int(input ("What is %s + %s? " % (num,num2)))
elif operators == 2:
answer = num - num2
question = int(input ("What is %s - %s? " % (num,num2)))
else:
answer = num * num2
question = int(input ("What is %s * %s? " % (num,num2)))
if answer == question:
print(“Well done!”)
else:
print(“Sorry, that is incorrect!”)
num = random.randint(1,10)
num2 = random.randint(1,10)
operators = random.randint(1,3)
myFunc()
i still need it to display the score at the end of the program and make it display the name,class and score variables in an exell file for the teachers use, if anyone could help i would greatly appreciate it!
I just don’t understand how to make a item of code within a defined function affect something outside of the defined area, if anyone can help then i would greatly appreciate it.
-Ben