max_guesses (!try setting this to or def main() print('''bagelsa deductive logic game by al sweigart al@inventwithpython com am thinking of {}-digit number with no repeated digits try to guess what it is here are some clues when saythat means pico one digit is correct but in the wrong position fermi one digit is correct and in the right position bagels no digit is correct for exampleif the secret number was and your guess was the clues would be fermi pico ''format(num_digits) while truemain game loop this stores the secret number the player needs to guess secretnum getsecretnum( print(' have thought up number ' print(you have {guesses to get it format(max_guesses) numguesses while numguesses <max_guesses guess ' keep looping until they enter valid guess while len(guess!num_digits or not guess isdecimal() print('guess #{}format(numguesses) guess input('' clues getclues(guesssecretnum print(clues numguesses + if guess =secretnum break they're correctso break out of this loop if numguesses max_guesses print('you ran out of guesses ' print('the answer was {format(secretnum) ask player if they want to play again print('do you want to play again(yes or no)' if not input(''lower(startswith(' ') break print('thanks for playing!' def getsecretnum() """returns string made up of num_digits unique random digits "" numbers list(' 'create list of digits to random shuffle(numbersshuffle them into random order get the first num_digits digits in the list for the secret numberbagels