Let the player enter a password guess.
(words, tries)
| 163 | |
| 164 | |
| 165 | def askForPlayerGuess(words, tries): |
| 166 | """Let the player enter a password guess.""" |
| 167 | while True: |
| 168 | print('Enter password: ({} tries remaining)'.format(tries)) |
| 169 | guess = input('> ').upper() |
| 170 | if guess in words: |
| 171 | return guess |
| 172 | print('That is not one of the possible passwords listed above.') |
| 173 | print('Try entering "{}" or "{}".'.format(words[0], words[1])) |
| 174 | |
| 175 | |
| 176 | # If this program was run (instead of imported), run the game: |