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

Зміст курсу

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.

Завдання
test

Swipe to show code editor

  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 desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

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.

Завдання
test

Swipe to show code editor

  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 desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Секція 1. Розділ 3
AVAILABLE TO ULTIMATE ONLY
We're sorry to hear that something went wrong. What happened?
some-alt