Contenu du cours
Crafting a Classic Hangman Game
Crafting a Classic Hangman Game
 Main Body
Main Body
Implementing the Hangman Function: The Core of the Program
In this function, we need to account for every possible user guess and display messages that communicate with the user. Additionally, this function will integrate all previously written functions.
It considers all potential user inputs: whether the input is not a letter, if the entered letter has already been used, if the letter is correctly guessed, and if it's incorrect. Accordingly, we specify the consequences of the chosen letter according to the rules established at the beginning of the project.
Tâche
Swipe to start coding
- Check if the word has not been guessed by using the is_word_guessedfunction with two parameters:gamewordandused_letters.
- Display the available letters by calling the get_available_lettersfunction with one parameter:used_letters.
- Check if the guessis not a valid letter.
- Verify if the guessed letter (guess) has already been used by referring to theused_lettersvariable.
- Determine if the guessed letter is present in the gameword.
- Check if guesses_remainingis equal to or less than 0.
Solution
Mark tasks as Completed
Tout était clair ?
Merci pour vos commentaires !
Section 1. Chapitre 8
AVAILABLE TO ULTIMATE ONLY