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

Зміст курсу

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.

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

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

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

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.

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