Conteúdo do Curso
Crafting a Classic Hangman Game
Crafting a Classic Hangman Game
Swipe to show menu
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.
Tarefa
Swipe to begin your solution
- Define the
get_guessed_word
function withgameword
andletters_already_guessed
as parameters. - Create a for loop to iterate through
gameword
usingi
as the iterator, utilizing therange()
function for iteration. - Implement a condition to determine if elements within
gameword
match any inletters_already_guessed
. - If the condition is met, append the letter
list(gameword)[i]
toresult_list
; otherwise, append'_ '
(including the space).
Solução
Mark tasks as Completed
Mude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?
Obrigado pelo seu feedback!
Seção 1. Capítulo 4
AVAILABLE TO ULTIMATE ONLY