Kursinnehåll
Crafting a Classic Hangman Game
Crafting a Classic Hangman Game
Available 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.
Uppgift
Swipe to start coding
- Define the
get_available_lettersfunction withletters_already_guessedas a parameter. - Initialize the
available_listvariable withstring.ascii_lowercaseto obtain the alphabet. - Create a
forloop to iterate through theavailable_listin reverse order. - Implement a condition to check if a letter in the
available_listmatches any inletters_already_guessed. - Remove the letter from the
available_listif it has already been guessed.
Lösning
Mark tasks as Completed
Var allt tydligt?
Tack för dina kommentarer!
Avsnitt 1. Kapitel 5
AVAILABLE TO ULTIMATE ONLY