import random max_nam = 10 guess_num = 3 def create_secret_num(guess_num): digits = list('0123456789') random.shuffle(digits) return ''.join(digits[:guess_num]) def attempt_check(attemt): clue = [] for i in range(len(attemt)): if attemt[i] == attemt[i]: clue.append("Fermi") if attemt[i] in attemt: clue.append("Pico") return ' '.join(clue) if clue else 'Bagle' def game(): secret_num = create_secret_num(guess_num) print("I meade a number.") 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("> ") if secret_num == attemt: print("You win!") break print(attempt_check(attemt)) # А вот и подсказка attemt_num += 1 print("You're done trying") print(f"The hiden numbers is {secret_num}") def main(): while True: game() answer = input("You want repeat the game?> ").lower() if answer == 'no': print("Thanks for playing") break if __name__ == '__main__': main()