Contenuti del Corso
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.
Compito
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.
Soluzione
Mark tasks as Completed
Tutto è chiaro?
Grazie per i tuoi commenti!
Sezione 1. Capitolo 5
AVAILABLE TO ULTIMATE ONLY