import random
import operator
print("Welcome to the Primary Maths Test!")
while True:
number1 = random.randint(1,12)
number2 = random.randint(1,12)
operator = random.randint(1,3)
if operator == 1:
operator.add(number1,number2)
else:
operator.sub(number1,number2)
答案 0 :(得分:1)
我认为你用整数变量'operator'覆盖模块'operator',只需给变量另一个名字,它就可以了。