from random import randint
correct = 0
for i in range(10):
n1 = randint(1,10)
n2 = randint(1,10)
prod = n1 * n2
ans = input('What\'s %d * %d? ' % (n1,n2))
if ans == prod:
print('That\'s Right! Well done.')
correct = correct + 1
else:
print('No, I\'m afraid the answer is %d.' % prod)
print('\nI asked you 10 questions. You got %d of them right.' % correct)
print('Well done!')
----------------------------------------------------------------------------
I wrote this program to try and figure out how everything works. I run the program and it asks me the product of 2 intergers. I type the correct answer and it always jumps to the "else" statement. I am using python 3.2. What am I doing wrong? Any help would be greatly appreciated!