This Python program is a word guessing game (similar to Hangman), where the user tries to guess a randomly selected word by guessing one letter at a time. The program displays the word with blanks for the unguessed letters and limits the number of attempts the user can make. It tracks the user's guessed letters and the remaining number of attempts.
- Randomly selects a word from a predefined list.
- Displays the word with blanks (
_
) for unguessed letters. - Updates the displayed word state after each correct guess.
- Limits the number of incorrect attempts (default is 6).
- Tracks the letters the user has guessed so far.
- The program randomly selects a word from a list of words.
- The word is displayed as blanks (
_
) for each unguessed letter. - The user guesses one letter at a time.
- After each guess, the program updates the word display:
- If the guessed letter is in the word, it replaces the corresponding blanks with the letter.
- If the guessed letter is not in the word, the program decreases the number of remaining attempts.
- The game continues until:
- The user guesses all the letters of the word correctly, or
- The user runs out of attempts.
- The program displays whether the user won or lost at the end of the game.
- Python 3.x
- Clone or download the project.
- Open a terminal or command prompt in the project directory.
- Run the following command:
python word_guessing_game.py