#samuel schofield
from random import*
def cleandivide(number1,number2):
clean=False
if number1%number2==0:
clean=True
else:
clean=False
return clean
score=0
questioncount=1
print("welcome to brain training")
questionnum=int(input("how meny questions do you want"))
print("you will be asked ",questionnum," questions")
name=input("enter your name")
nickname=input("what is your nickname")
print("ok ",name)
print("but i will call you",nickname)
while questioncount<=questionnum:
num1=randint(1,10)
num2=randint(1,10)
questionchoice=randint(4,4)
print("question",questioncount)
if questionchoice==1:
print(num1,"+",num2,"= ?")
answer=int(input("what is your answer"))
companswer=num1+num2
if answer==companswer:
print("correct")
score=score+1
else:
print("incorect")
print("your score is",score)
if questionchoice==2:
print(num1,"-",num2,"= ?")
answer=int(input("what is your answer"))
companswer=num1-num2
if answer==companswer:
print("correct")
score=score+1
else:
print("incorect")
print("your score is",score)
if questionchoice==3:
print(num1,"*",num2,"= ?")
answer=int(input("what is your answer"))
companswer=num1*num2
if answer==companswer:
print("correct")
score=score+1
else:
print("incorect")
print("your score is",score)
if questionchoice==4:
clear=False
while clear==False:
clear=cleandivide(num1,num2)
if clear==False:
num1=randint(1,10)
num2=randint(1,10)
print(num1,"/",num2,"= ?")
answer=int(input("what is your answer"))
companswer=num1/num2
if answer==companswer:
print("correct")
score=score+1
else:
print("incorect")
print("your score is",score)
questioncount=questioncount+1
print("your final score is",score)
prevhighscore = open("highscorefile.txt", "r")
prevscore = int(prevhighscore.readline())
prevhighscore.close()
if prevscore<score:
newscore=str(score)
prevhighscore = open("highscorfile", "w")
prevhighscore.write(newscore)
prevhighscore.write(nickname)
print("congratulations",nickname,"you got a new high score")
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}