Answered step by step
Verified Expert Solution
Question
1 Approved Answer
python Write a program to play the game of hangman. Regular hangman game rules: Choose one person to be the executioner. That person will think
python
Write a program to play the game of hangman. Regular hangman game rules: Choose one person to be the executioner. That person will think of a word or short phrase and mark out blanks (short lines) for each letter of each word. Separate words with either a slash, a fairly wide gap, or place words on separate lines. Then another player will guess a letter. If that letter is in the word(s) then write the letter in everywhere it would appear, and cross out that letter in the alphabet. If the letter isn't in the word or phrase then add a body part to the gallows (head, body, left arm, right arm, left leg, right leg). The player will continue guessing letters until they can either solve the word or phrase, or all six body parts are on the gallows. Requirements for this assignment: Drawing is completely optional! . You must use functions The user can play game after game without having to restart your program Create a list of about 30 words or phrases. Each time the game is played, one of these will be randomly picked as the puzzle. The puzzle can contain only uppercase letters. If there is a hyphen then the hyphen is displayed from the beginning. Every guess by the user must be unique for that game. i.e., if they enter then enter E again, the second guess doesn't count. Keep track of how many games the computer wins vs the player and display after every game. Example output: Sorry, computer wins . Computer has won 7 games to your 1 . Would you like a rematch (Y/N)? Print dashes for every letter in the solution. If more than one word then separate words by I. Example: When the user guesses correctly, add that letter to all correct spots and display all correct letters up to that point. Example, guessing E when Vis already known _EVE__E_ When the user guesses incorrectly, add that letter to the sorted list of incorrect guesses and display the list, followed by the solution so far. Example when wrongly guessing Q: - Q is incorrect - Incorrect guesses so far are: B, M, Q Puzzle so far is_EVE_/_E__ Seven incorrect guesses mean the player loses and the computer wins. Example, rather than above output: .Q is incorrect . That is 7 incorrect guesses so you lose; 1 win! When the game is over, display the puzzle solution: - Answer was: SEVEN/SEAS In your submission, include source code and multiple output snippets (winning, losing, multiple games, etc.) to demonstrate your program works 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