import random
C = [1,2,3,4,5,6,7,8,9,0]
A = random.sample(C,4)
#print(len(B),len(set(B)))
#state = 1
def Input01():
global B1
B1 = eval(input("请输入4位不重复的1位整数:"))
if (set(B1) < set(C)) and len(set(B1))==4 and len(B1)==4:
print("Come on!")
else:
Input01()
return B1
def func01(B1):
gh=0
gy=0
B1=list(B1)
print(B1)
for i in range(4):
if A[i]==B1[i]:
gh = gh + 1
else:
if A[i] in B1:
gy = gy+1
return (gh,gy)
def main():
B = Input01()
(gh,gy) = func01(B)
print(gh,"A",gy,"B")
while gh<4:
B = Input01()
(gh,gy) = func01(B)
print(gh,"A",gy,"B")
else:
print("Exllent!!!")
print("Game Over")
import time
time.sleep(5)
main()