20以内的加法,要怎么设置条件
import random
def num_20():
num_1 = random.randint(1,20)
num_2 = random.randint(1,20)
result = random.randint(2,20)
result = num_1 + num_2
if result <= 20:
result = input("%d + %d = " % (num_1,num_2))
result = int(result)
if result == num_1 + num_2:
print("√")
else:
print("×")
else:
pass