48 lines
1.1 KiB
Python
48 lines
1.1 KiB
Python
import random
|
|
|
|
|
|
max_nam = 10
|
|
guess_num = 3
|
|
digits = "0123456789"
|
|
|
|
while True:
|
|
digits = list(digits)
|
|
random.shuffle(digits)
|
|
secret_num = ''
|
|
for i in digits[0:3]:
|
|
secret_num += i
|
|
|
|
print("I mean digit.")
|
|
attemt_num = 1
|
|
|
|
|
|
while max_nam >= attemt_num:
|
|
attemt = ''
|
|
while len(attemt) != guess_num or not attemt.isdecimal():
|
|
print(f"Attemt № {attemt_num}")
|
|
attemt = input("> ")
|
|
|
|
clue = []
|
|
|
|
if secret_num == attemt:
|
|
print("You win!")
|
|
break
|
|
|
|
for i in range(len(attemt)):
|
|
|
|
if secret_num[i] == attemt[i]:
|
|
clue.append("Fermi")
|
|
if attemt[i] in secret_num:
|
|
clue.append("Pico")
|
|
if len(clue) == 0:
|
|
print("Bagle")
|
|
else:
|
|
sorted(clue)
|
|
print(' '.join(clue))
|
|
attemt_num += 1
|
|
print("You spent your attemt")
|
|
print(f"You want repit the game. The hiden numbers is {secret_num}? 'yes' or 'no'")
|
|
answer = input("> ")
|
|
if answer == 'no':
|
|
print("Thanks for playing")
|
|
break |