Implement a python version of the game Hangman in which a player attempts to guess a secret word one letter at a time. Normally Hangman is a two-player game but in your version the user will play three rounds against the computer. Use the following as the secret word in each round: 1. “APPLE” 2. “OBVIOUS” 3. “XYLOPHONE” Here are the steps to follow in each round: Print the secret word with each letter replaced with the underscore character, “_” Prompt the user to enter a letter or word using the following message, “Enter a letter or word: ”. If the user enters a single letter, check if that letter is in the secret word (case-insensitive). The user can make up to 6 letter guesses in a round. If the user guesses a letter they have already guessed, print the message “You've already guessed that letter!” and don’t count it as one of their 6 guesses. Go straight to step 6. If the user enters a word, check if the word matches the secret word (case-insensitive). Word guesses should not count toward the user’s total number of guesses. After the user has made their guess, check if the game is over. The game is over if the user has guessed 6 letters but not revealed the word (they lose) or, if the user correctly guesses the word. If the game is NOT over: Print the secret word with all letters except any the user has correctly guessed replaced by underscores. Print “Your guesses so far: “ followed by each letter the user has guessed so far. Return to step 2. If the game is over, print the result. If the player won, print “You win!” If the player lost, print “You lose! The word was “ followed by the secret word Move on to the next round, if applicable. When the user has played all three rounds, print “You won out of 3”, where is the number of rounds the player won.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Implement a python version of the game Hangman in which a player attempts to guess a secret word one letter at a time. Normally Hangman is a two-player game but in your version the user will play three rounds against the computer. Use the following as the secret word in each round:

1. “APPLE”
2. “OBVIOUS”
3. “XYLOPHONE”

Here are the steps to follow in each round:

  1. Print the secret word with each letter replaced with the underscore character, “_”

  2. Prompt the user to enter a letter or word using the following message, “Enter a

    letter or word: ”.

  3. If the user enters a single letter, check if that letter is in the secret word (case-insensitive). The user can make up to 6 letter guesses in a round. If the user guesses a letter they have already guessed, print the message “You've already guessed that letter!” and don’t count it as one of their 6 guesses. Go straight to step 6.

  4. If the user enters a word, check if the word matches the secret word (case-insensitive). Word guesses should not count toward the user’s total number of guesses.

  5. After the user has made their guess, check if the game is over. The game is over if the user has guessed 6 letters but not revealed the word (they lose) or, if the user correctly guesses the word.

  6. If the game is NOT over:

    1. Print the secret word with all letters except any the user has correctly guessed replaced by underscores.

    2. Print “Your guesses so far: “ followed by each letter the user has

      guessed so far.

    3. Return to step 2.

  7. If the game is over, print the result.

    1. If the player won, print “You win!”

    2. If the player lost, print “You lose! The word was “ followed by the secret word

    3. Move on to the next round, if applicable.

When the user has played all three rounds, print “You won <X> out of 3”, where <X> is the number of rounds the player won.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 5 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY