Contenu du cours
Crafting a Classic Hangman Game
Crafting a Classic Hangman Game
 State of Affairs
State of Affairs
Tracking the Game Word's Progress
To keep the user informed about the progress of their guesses, it's essential to display both the number of correctly guessed letters and the letters still to be guessed after each attempt.
For this purpose, we will develop the get_guessed_word function. This function will maintain a result_list, which represents the current state of the gameword, including correctly guessed letters and placeholders for the remaining letters.
Tâche
Swipe to start coding
- Define the get_guessed_wordfunction withgamewordandletters_already_guessedas parameters.
- Create a for loop to iterate through gamewordusingias the iterator, utilizing therange()function for iteration.
- Implement a condition to determine if elements within gamewordmatch any inletters_already_guessed.
- If the condition is met, append the letter list(gameword)[i]toresult_list; otherwise, append'_ '(including the space).
Solution
Mark tasks as Completed
Tout était clair ?
Merci pour vos commentaires !
Section 1. Chapitre 4
AVAILABLE TO ULTIMATE ONLY