import random#随机数模板
A=set()#声明两个集合存放生成的随机数
B=set()
for step in range(random.randint(1,10)):#决定有几个随机数
A.add(random.randint(0,9))#决定这几个随机数是什么
for step in range(random.randint(1,10)):
B.add(random.randint(0,9))
print("set A:",A)
print("set B:",B)
unioninput=set([int(n) for n in input("please input A|B :").split()])#存储输入的A|B
andinput=set([int(n) for n in input("please input A&B:").split()])#存储输入的A&B
for a in range(0,3):
if A|B==unioninput and A&B==andinput:#若两个输入均正确
print("You are right!")
elif a==2:#第三次仍输入不正确时
print("Sorry, you are wrong:")
print("A|B:",A|B)
print("A&B:",A&B)
else:#前两次输入不正确时
print("Sorry, you are wrong:")
unioninput=set(input("please input A|B again :"))
andinput=set(input("please input A&B again:"))