1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| from random import randint
code = oct(randint(4096,8191))[3:]
print(code)
for coup in range(10):
while True:
try:
propos = input('votre proposition: ')
(int(propos,8)<=4095) / (len(propos)==4)
break
except:
print("format non valide")
x = [1 for a,b in zip(propos,code) if a==b]
codecopy = list(code)
y = [codecopy.remove(i)for i in propos if i in codecopy]
if len(y)+len(x) == 8:
print('bien vu, le code etait bien ',code)
break
print(len(y)," bon(s) ",len(x)," bien place(s)")
else:
print("desole, cest perdu") |
Partager