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

Зміст курсу

Crafting a Classic Hangman Game

bookAvailable Letters

Displaying Available Letters

To assist users, we display the letters that are still available for guessing after each attempt. Any letter that has been guessed should be removed from the available_list. For this purpose, we will implement the get_available_letters function.

Завдання
test

Swipe to show code editor

  1. Define the get_available_letters function with letters_already_guessed as a parameter.
  2. Initialize the available_list variable with string.ascii_lowercase to obtain the alphabet.
  3. Create a for loop to iterate through the available_list in reverse order.
  4. Implement a condition to check if a letter in the available_list matches any in letters_already_guessed.
  5. Remove the letter from the available_list if it has already been guessed.

Mark tasks as Completed
Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

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

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

Displaying Available Letters

To assist users, we display the letters that are still available for guessing after each attempt. Any letter that has been guessed should be removed from the available_list. For this purpose, we will implement the get_available_letters function.

Завдання
test

Swipe to show code editor

  1. Define the get_available_letters function with letters_already_guessed as a parameter.
  2. Initialize the available_list variable with string.ascii_lowercase to obtain the alphabet.
  3. Create a for loop to iterate through the available_list in reverse order.
  4. Implement a condition to check if a letter in the available_list matches any in letters_already_guessed.
  5. Remove the letter from the available_list if it has already been guessed.

Mark tasks as Completed
Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Секція 1. Розділ 5
AVAILABLE TO ULTIMATE ONLY
We're sorry to hear that something went wrong. What happened?
some-alt