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

Зміст курсу

Crafting a Classic Hangman Game

bookMain 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.

Завдання

  1. Check if the word has not been guessed by using the is_word_guessed function with two parameters: gameword and used_letters.
  2. Display the available letters by calling the get_available_letters function with one parameter: used_letters.
  3. Check if the guess is not a valid letter.
  4. Verify if the guessed letter (guess) has already been used by referring to the used_letters variable.
  5. Determine if the guessed letter is present in the gameword.
  6. Check if guesses_remaining is equal to or less than 0.

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

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

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

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.

Завдання

  1. Check if the word has not been guessed by using the is_word_guessed function with two parameters: gameword and used_letters.
  2. Display the available letters by calling the get_available_letters function with one parameter: used_letters.
  3. Check if the guess is not a valid letter.
  4. Verify if the guessed letter (guess) has already been used by referring to the used_letters variable.
  5. Determine if the guessed letter is present in the gameword.
  6. Check if guesses_remaining is equal to or less than 0.

Mark tasks as Completed
Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Секція 1. Розділ 8
AVAILABLE TO ULTIMATE ONLY
some-alt