'''check addition'''
from random import randint
def checkAddition( a, b ):
ans = int(raw_input("What is %d + %d ? " % (a,b)))
if ans == a + b:
return True
else:
return False
def main():
x = randint(1,100)
y = randint(1,100)
if checkAddition(x,y):
print "Correct"
else:
print "Incorrect"
main()
This is code that simply checks addition but now I have to embed function in a loop generating 2 random numbers between 1 & 100. counting both total no. of questions & no. of correct responses and also continue loop if you wish or exit if not ..
Any help guys Really appreciated ,,