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

Зміст курсу

Crafting a Classic Hangman Game

bookHints 1/2

Guessing the word from a large file can be challenging, so we provide users with the option to use a hint.

Adding Hint Functionality

To integrate hint functionality into our program, we'll proceed in two phases. The hints_match function determines whether the current state of the gameword—which includes correctly guessed letters and placeholders—corresponds exactly to any word in the file. The function will return True if there's a match and False otherwise.

Завдання
test

Swipe to show code editor

  1. Define the hints_match function with word_to_match and word_from_list as parameters.
  2. Remove spaces from word_to_match.
  3. Compare the lengths of test_list and other_list.
  4. Return False if the lengths differ.
  5. Initialize a for loop to iterate through test_list.
  6. Increment the counter.

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

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

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

Guessing the word from a large file can be challenging, so we provide users with the option to use a hint.

Adding Hint Functionality

To integrate hint functionality into our program, we'll proceed in two phases. The hints_match function determines whether the current state of the gameword—which includes correctly guessed letters and placeholders—corresponds exactly to any word in the file. The function will return True if there's a match and False otherwise.

Завдання
test

Swipe to show code editor

  1. Define the hints_match function with word_to_match and word_from_list as parameters.
  2. Remove spaces from word_to_match.
  3. Compare the lengths of test_list and other_list.
  4. Return False if the lengths differ.
  5. Initialize a for loop to iterate through test_list.
  6. Increment the counter.

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