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

Contenido del 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.

Tarea
test

Swipe to show code editor

  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 desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

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.

Tarea
test

Swipe to show code editor

  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 desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
Sección 1. Capítulo 4
AVAILABLE TO ULTIMATE ONLY
We're sorry to hear that something went wrong. What happened?
some-alt