You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: projects/build-a-word-guessing-game-with-python/build-a-word-guessing-game-with-python.mdx
+19-19Lines changed: 19 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -145,11 +145,11 @@ We're almost done! We'll know if the player has won the game when they guess all
145
145
break
146
146
```
147
147
148
-
Finally, we need a condition that results in a loss for the player when they run out of `attempts` and reveal the correct word.
148
+
Finally, we need a condition that results in a loss for the player when they run out of `attempts` and reveal the correct word. This means that this line of code needs to be written outside of the `while()` loop.
149
149
150
150
```py
151
-
else:
152
-
print('\nYou\'ve run out of attempts! The word was: '+ word)
151
+
if attempts ==0and'_'in guessedWord::
152
+
print('\nYou\'ve run out of attempts! The word was: '+ word)
153
153
```
154
154
155
155
**Note:** We don't need to break the `while` loop because the condition was `while attempts > 0`.
@@ -158,24 +158,24 @@ When you're finished, the game loop should look something like this:
0 commit comments