Create simple word guessing game in Python. In this game, you will choose a hidden word, and the player has to guess each letter of the hidden word. The player will lose a life for every wrong answer and win if they guess the entire word.
# Here are the rules and instructions for the game:
1. You need to choose a hidden word, and the player's task is to guess it letter by letter.
2. The player starts with a certain number of lives (e.g., 5 lives).
3. At the beginning of the game, print a message to inform the player how many lives they have and display an empty line for each letter in the hidden word (use underscores to represent the letters). For example, if the hidden word is "PYTHON," and the player has 5 lives, it should look like this: "You have 5 attempts to guess the word.
Word: _ _ _ _ _ _"
4. Prompt the player to guess a letter and read their input.
5. Check if the guessed letter is in the hidden word. If it is, reveal the letter in the appropriate position(s) of the word display. If not, subtract one life from the player and print a message that the guess was wrong.
6. Continue the game until the player either guesses the entire word or runs out of lives.
7. If the player guesses the entire word, print a message declaring them the winner.
8. If the player runs out of lives, print a message declaring them the loser.
# Constraints:
# Here are the rules and instructions for the game:
1. You need to choose a hidden word, and the player's task is to guess it letter by letter.
2. The player starts with a certain number of lives (e.g., 5 lives).
3. At the beginning of the game, print a message to inform the player how many lives they have and display an empty line for each letter in the hidden word (use underscores to represent the letters). For example, if the hidden word is "PYTHON," and the player has 5 lives, it should look like this: "You have 5 attempts to guess the word.
Word: _ _ _ _ _ _"
4. Prompt the player to guess a letter and read their input.
5. Check if the guessed letter is in the hidden word. If it is, reveal the letter in the appropriate position(s) of the word display. If not, subtract one life from the player and print a message that the guess was wrong.
6. Continue the game until the player either guesses the entire word or runs out of lives.
7. If the player guesses the entire word, print a message declaring them the winner.
8. If the player runs out of lives, print a message declaring them the loser.
# Constraints:
- Use only loops and conditional statements (if, elif, else).
- Do not use functions, word lists, or lists to store data.
- The hidden word should be in all capital letters.
- It is a must that the player guesses per letter of the hidden word.
Attachments
-
You do not have permission to view the full content of this post. Log in or register now.