Course Content
Crafting a Classic Hangman Game
Crafting a Classic Hangman Game
Hints 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.
Task
Swipe to start coding
- Define the
hints_matchfunction withword_to_matchandword_from_listas parameters. - Remove spaces from
word_to_match. - Compare the lengths of
test_listandother_list. - Return
Falseif the lengths differ. - Initialize a
forloop to iterate throughtest_list. - Increment the
counter.
Solution
Mark tasks as Completed
Everything was clear?
Thanks for your feedback!
SectionΒ 1. ChapterΒ 6
AVAILABLE TO ULTIMATE ONLY