def makeQ(self):
nums1 = [2,3,4,5,6,7,8,9,10] #creating array of numbers to multiply
num1 = random.choice(nums1) #choosing random number to multiply
nums2 = [2,3,4,5,6,7,8,9,10]
num2 = random.choice(nums2)
q1 = ("What is {0} multiplied by {1}? ").format(num1, num2) #question string
a1 = int( num1 * num2 ) #What is num1 times num2
i = 0
options = []
while (i<4):
options.append(random.randint(1,100))
i+=1
options.append(a1)
random.shuffle(options)
print("Choose the correct answer: {0}").format(options)
return q1, a1, options
评论列表
文章目录