"""run single game of hacking "" print('''hacking minigameby al sweigart al@inventwithpython com find the password in the computer' memory you are given clues after each guess for exampleif the secret password is monitor but the player guessed containthey are given the hint that out of letters were correctbecause both monitor and contain have the letter and as their nd and rd letter you get four guesses \ ''' input('press enter to begin ' gamewords getwords( the "computer memoryis just cosmeticbut it looks cool computermemory getcomputermemorystring(gamewords secretpassword random choice(gamewords print(computermemory start at tries remaininggoing down for triesremaining in range( - ) playermove askforplayerguess(gamewordstriesremaining if playermove =secretpassword print(' ' return else nummatches nummatchingletters(secretpasswordplayermove print('access denied ({}/ correct)format(nummatches) print('out of tries secret password was {format(secretpassword) def getwords() """return list of words that could possibly be the password the secret password will be the first word in the list to make the game fairwe try to ensure that there are words with range of matching numbers of letters as the secret word "" secretpassword random choice(words words [secretpassword find two more wordsthese have zero matching letters we use " because the secret password is already in words while len(words randomword getonewordexcept(words if nummatchingletters(secretpasswordrandomword= words append(randomword find two words that have matching letters (but give up at tries if not enough can be found for in range( ) if len(words= break found wordsso break out of the loop randomword getonewordexcept(words if nummatchingletters(secretpasswordrandomword= words append(randomword project #