#random.seed() should not be used here as this method will produce same number again and again
a = random.randint(1,11) #this method will generate random number between 1 and 10
b = random.randint(1,11)
print ("What is: " + str(a) + " X " + str(b) + "?")
ans = int(input("Your answer: "))
if (a * b == ans):
print ("Correct!")
else:
print ("Incorrect!")
Output :
What is: 8 X 5?
Your answer: 40
Correct!
Explanation:
First for producing random numbers,random module has to be imported.
As mentioned in answer, random.seed() method is used to generate same random number again and again. Here we need to generate 2 different random numbers that is why we won't use this method.
To produce a random number, randint() method from random module is used. This method takes 2 parameters i.e. a low and high value. The low value is inclusive and the high value is exclusive. That is why , to get a number between [1,10], randint() takes 1 as low value(inclusive) and 11 as high value(exclusive).