Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Instructions Hangman The task is to implement a word guessing game on the model of Hangman. The game starts with a hidden word in which
Instructions
Hangman
The task is to implement a word guessing game on the model of "Hangman". The game starts with a hidden word in which hyphens are displayed in place of letters. The player guesses a letter, and if the letter is in the word, the word display is updated to reveal the letter in place. If the word does not contain the letter guessed, the player gets one "strike".
NOTE: you do not need to implement the drawing of the hanged man, as in the children's game.
If the player gets five strikes before all letters are revealed, the player loses. If the player is able to guess all letters before getting five strikes, the player wins.
Requirements
Your program should do the following:
Include a function that take a word and list of letters guessed and returns a string that displays the letters guessed only, with hyphens in place of letters not guessed. HINT: You can loop over the letters in a word and concatenate a new word from letters and hyphens depending on whether a given letter is present in a list of letters guessed.
Display the letters guessed so far to the user.
Be able to handle user input in either uppercase or lowercase.
Allow the user to quit the game by typing "quit".
Instructions
The task is to implement a word guessing game on the model of "Hangman". The game starts with a hidden word in which hyphens are displayed in place of letters. The player guesses a letter, and if the letter is in the word, the word display is updated to reveal the letter in place. If the word does not contain the letter guessed, the player gets one "strike".
NOTE: you do not need to implement the drawing of the hanged man, as in the children's game.
If the player gets five strikes before all letters are revealed, the player loses. If the player is able to guess all letters before getting five strikes, the player wins.
Requirements
Your program should do the following:
Include a function that take a word and list of letters guessed and returns a string that displays the letters guessed only, with hyphens in place of letters not guessed. HINT: You can loop over the letters in a word and concatenate a new word from letters and hyphens depending on whether a given letter is present in a list of letters guessed.
Display the letters guessed so far to the user.
Be able to handle user input in either uppercase or lowercase.
Allow the user to quit the game by typing "quit".
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started