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

Conteúdo do Curso

Crafting a Classic Hangman Game

bookGuessed Word

Preventing Excessive Gameplay

The program must recognize when to cease prompting the user for letters once the word has been successfully guessed. To achieve this, we'll develop the is_word_guessed function. This function will effectively communicate:

Great, the player has guessed the word correctly! It's time to halt the program and congratulate the player.

Tarefa

  1. Define the is_word_guessed function with gameword and letters_already_guessed as parameters.
  2. Implement a condition to verify whether letters_already_guessed matches gameword.
  3. Return True if the condition is met, and False otherwise.

Note

During the execution of the second step, employ the set(gameword) & set(letters_already_guessed) expression to compare it with the set(gameword). This approach ensures that only the letters from letters_already_guessed that are in gameword are considered. The & operator identifies letters common to both sets.

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!

Preventing Excessive Gameplay

The program must recognize when to cease prompting the user for letters once the word has been successfully guessed. To achieve this, we'll develop the is_word_guessed function. This function will effectively communicate:

Great, the player has guessed the word correctly! It's time to halt the program and congratulate the player.

Tarefa

  1. Define the is_word_guessed function with gameword and letters_already_guessed as parameters.
  2. Implement a condition to verify whether letters_already_guessed matches gameword.
  3. Return True if the condition is met, and False otherwise.

Note

During the execution of the second step, employ the set(gameword) & set(letters_already_guessed) expression to compare it with the set(gameword). This approach ensures that only the letters from letters_already_guessed that are in gameword are considered. The & operator identifies letters common to both sets.

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 3
AVAILABLE TO ULTIMATE ONLY
some-alt