Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
State of Affairs | Crafting a Classic Hangman Game
Crafting a Classic Hangman Game
course content

Conteúdo do Curso

Crafting a Classic Hangman Game

bookState 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

  1. Define the get_guessed_word function with gameword and letters_already_guessed as parameters.
  2. Create a for loop to iterate through gameword using i as the iterator, utilizing the range() function for iteration.
  3. Implement a condition to determine if elements within gameword match any in letters_already_guessed.
  4. If the condition is met, append the letter list(gameword)[i] to result_list; otherwise, append '_ ' (including the space).

Mark tasks as Completed
Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

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

  1. Define the get_guessed_word function with gameword and letters_already_guessed as parameters.
  2. Create a for loop to iterate through gameword using i as the iterator, utilizing the range() function for iteration.
  3. Implement a condition to determine if elements within gameword match any in letters_already_guessed.
  4. If the condition is met, append the letter list(gameword)[i] to result_list; otherwise, append '_ ' (including the space).

Mark tasks as Completed
Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Seção 1. Capítulo 4
AVAILABLE TO ULTIMATE ONLY
some-alt