mardi 27 janvier 2015

Pyhton Invalid Syntax IF statement

I'm trying to make a quiz in python but I keep getting invalid syntax errors.



#This is for addition questions.

if (question=add) <---- That is where i get the error
for i in range(0,10):
first_number_add=random.randint(1,50)
second_number_add=random.randint(1,50)
answer=int(input(str(first_number_add) + '+' + str(second_number_add) + '='))
sum=first_number_add+second_number_add
if (answer==sum):
print ('Correct')
stats['correct'] += 1
else:
print ('Incorrect.')
stats['incorrect'] += 1

Aucun commentaire:

Enregistrer un commentaire