Hey all,
Will the following code ever exit, or do I have to change something so that
it will exit? It's a sample of what I'm currently working on.
import random
def add(a,b):
answer = a+b
guess = float(raw_input(a," + ",b," = "))
num1 = random.choice(range(1,10))
num2 = random.choice(range(1,10))
q = random.choice(range(15,31)
cq = 1 while cq >= q: add(num1,num2) if guess != answer: print "Incorrect! The correct answer
is: ",answer
incorrect += 1 cq += 1 elif guess == answer: print "Correct!" correct += 1 cq += 1 else: print "Questions: ",q print "Correct: ",correct print "Percent Correct: ",(correct/q)*100 Thanks,
Nathan Pinno
|
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor