Зміст курсу
Crafting a Classic Hangman Game
Crafting a Classic Hangman Game
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.
Завдання
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).
Рішення
Mark tasks as Completed
Все було зрозуміло?
Дякуємо за ваш відгук!
Секція 1. Розділ 4
AVAILABLE TO ULTIMATE ONLY