import random
import time
counter=0
score=0
count=0
function=['+','x','÷','-']
print('Welcome To The Arithmetic Quiz!')
name=input('Please enter you name..')
print('Thanks' , name , 'Lets Get Started!')
while counter <10:
firstnumber=random.randint(0,12)
secondnumber=random.randint(0,6)
function=random.choice(function)
question=print(firstnumber, function, secondnumber, '=')
input('Answer:')
counter= counter+1
if function== '+':
count==firstnumber+secondnumber
if count == int (answer):
print ('Correct!')
score= score+1
else:
print ('Incorrect')
elif function== 'x':
count==firstnumber*secondnumber
if count == int (answer):
print ('Correct!')
score= score+1
else:
print ('Incorrect')
elif function== '-':
count==firstnumber-secondnumber
if count == int (answer):
print ('Correct!')
score= score+1
else:
print ('Incorrect')
elif function== '÷':
count==firstnumber/secondnumber
if count == int (answer):
print ('Correct!')
score= score+1
else:
print ('Incorrect')
Could anybody correct the end section ( if
function ) and ( elif
function )
I think it is something to do with the variable names.
It also does not run properly as it stops at: print('Thanks' , name , 'Lets Get Started!')
, again I am unsure why this is.