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

Course Content

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.

Task

  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 desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your 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.

Task

  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 desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Section 1. Chapter 3
AVAILABLE TO ULTIMATE ONLY
some-alt