import random as rn
def mh(stay=True):
secret = rn.choice('abc')
answer = rn.choice('abc')
if secret == answer:
if stay:
return True
else:
return False
else:
if stay:
return False
else:
lol = ''.join([i for i in 'abc' if i!=answer and i!=secret])
answer = ''.join([i for i in 'abc'.replace(lol,'') if i != answer])
if answer == secret:
return True
return False
def test(t=True):
k = 0
for i in range(1, 10000):
if mh(stay=t):
k+=1
return k
if __name__=='__main__':
print(test())
print(test(t=False))
aW1wb3J0IHJhbmRvbSBhcyBybgpkZWYgbWgoc3RheT1UcnVlKToKICAgIHNlY3JldCA9IHJuLmNob2ljZSgnYWJjJykKICAgIGFuc3dlciA9IHJuLmNob2ljZSgnYWJjJykKICAgIGlmIHNlY3JldCA9PSBhbnN3ZXI6CiAgICAgICAgaWYgc3RheToKICAgICAgICAgICAgcmV0dXJuIFRydWUKICAgICAgICBlbHNlOgogICAgICAgICAgICByZXR1cm4gRmFsc2UKICAgIGVsc2U6CiAgICAgICAgaWYgc3RheToKICAgICAgICAgICAgcmV0dXJuIEZhbHNlCiAgICAgICAgZWxzZToKICAgICAgICAgICAgbG9sID0gJycuam9pbihbaSBmb3IgaSBpbiAnYWJjJyBpZiBpIT1hbnN3ZXIgYW5kIGkhPXNlY3JldF0pCiAgICAgICAgICAgIGFuc3dlciA9ICcnLmpvaW4oW2kgZm9yIGkgaW4gJ2FiYycucmVwbGFjZShsb2wsJycpIGlmIGkgIT0gYW5zd2VyXSkKICAgICAgICAgICAgaWYgYW5zd2VyID09IHNlY3JldDoKICAgICAgICAgICAgICAgIHJldHVybiBUcnVlCiAgICAgICAgICAgIHJldHVybiBGYWxzZQoKZGVmIHRlc3QodD1UcnVlKToKICAgIGsgPSAwCiAgICBmb3IgaSBpbiByYW5nZSgxLCAxMDAwMCk6CiAgICAgICAgaWYgbWgoc3RheT10KToKICAgICAgICAgICAgays9MQogICAgcmV0dXJuIGsKCmlmIF9fbmFtZV9fPT0nX19tYWluX18nOgogICAgcHJpbnQodGVzdCgpKQogICAgcHJpbnQodGVzdCh0PUZhbHNlKSk=