Loading…
![]() String added in the repository |
Things to check
Key
adventures->hangman_2->levels->17->story_textFlags
ignore-double-space, ignore-ellipsis, ignore-inconsistent, ignore-long-untranslated, ignore-same, ignore-translated, placeholders:r"`([^`\n\r]+)`|## ", python-brace-format
### Exercise
***Paste your code*** Copy your code from the previous tab and paste the code in the programming field.
***The game*** This games continues playing until Player 2 is game over. Fill in the while command accordingly. Now, Player 2 is allowed to guess a letter, so ask Player 2 to guess a letter.
We need to check if their answer is correct, so check if their `guess` is (somewhere) in the (list) `answer`. Then we let the computer figure out which of the letter(s) is the guess. We have already programmed that part for you.
Next we want to compliment the player for finding a correct letter and we want to print the list `guessed_letters`, so the player can see their progress.
The next part we're going to program is what happens when the player has guessed all of the letters. So if their list of `guessed_letters` is the same as our list `answer`.
If the lists are the same, congratulate Player 2 with their victory and set the variable `game_over` to `True`.
Next we'll program what happens when Player 2 guesses wrong (so the `{else}` command). First, tell the player that their guess was wrong. Then increase the `mistakes_made` variable by 1.
For the last part we'll program what happens when Player 2 has made 10 mistakes. We'll print that Player 1 has won the game. Then we'll print the correct answer. And finally, we'll set our `game_over` variable to `True`, so the game stops.
***Go to the next tab*** Amazing work! Your game is playable, but wouldn't it be fun if the hangman was actually drawn when Player 2 makes a mistake..?
### Exercise
***Paste your code*** Copy your code from the previous tab and paste the code in the programming field.
***The game*** This games continues playing until Player 2 is game over. Fill in the while command accordingly. Now, Player 2 is allowed to guess a letter, so ask Player 2 to guess a letter.
We need to check if their answer is correct, so check if their `guess` is (somewhere) in the (list) `answer`. Then we let the computer figure out which of the letter(s) is the guess. We have already programmed that part for you.
Next we want to compliment the player for finding a correct letter and we want to print the list `guessed_letters`, so the player can see their progress.
The next part we're going to program is what happens when the player has guessed all of the letters. So if their list of `guessed_letters` is the same as our list `answer`.
If the lists are the same, congratulate Player 2 with their victory and set the variable `game_over` to `True`.
Next we'll program what happens when Player 2 guesses wrong (so the `{else}` command). First, tell the player that their guess was wrong. Then increase the `mistakes_made` variable by 1.
For the last part we'll program what happens when Player 2 has made 10 mistakes. We'll print that Player 1 has won the game. Then we'll print the correct answer. And finally, we'll set our `game_over` variable to `True`, so the game stops.
***Go to the next tab*** Amazing work! Your game is playable, but wouldn't it be fun if the hangman was actually drawn when Player 2 makes a mistake..?