[Solved] How do I store a variable in Python


here is a simple way to do this :

import random

score = 0
number = int(raw_input ('hello, please enter a times table you would like to practice \n'))    
while number > 12 or number < 2: 
    if number > 12:
        print 'number is too big must be between 2 and 12 \n'
    else:
        print 'number is too small must be between 2 and 12 \n'
    number = int(raw_input('please enter a number between 2 and 12: \n'))

for i in range (11):

    num_1 = random.randint(2, 12)
    answer = int(raw_input('%s what is %s times %s ?\n)'%(i,number,num_1)))

    if answer == number*num_1:
        print 'Right answer!'
        score += 1
    else:
        print 'Wrong answer!\nThe correct answer was %s'%(number*num_1)

print 'You made a score of %s'%score

5

solved How do I store a variable in Python