Hangman game in Python
This is a simple Hangman game implemented in Python. The game randomly selects a word from a predefined list and allows the player to guess letters or the entire word within a limited number of attempts.
- Randomly selects a word from a list of predefined words.
- Allows the player to guess letters or the entire word.
- Displays the current state of the Hangman after each guess.
- Keeps track of guessed letters and words.
- Provides feedback on the player's progress and notifies when the game is won or lost.
- Python 3.x installed on your machine.
-
Clone the repository
git clone https://github.com/Aysenur-Erkin/hangman.git cd hangman
-
Run the game
python hangman.py
- The game will display a series of underscores representing the letters of the word to guess.
- You can guess a letter or the entire word.
- If your guess is correct, the letter(s) will be revealed in the word.
- If your guess is incorrect, you lose one of your tries.
- The game ends when you guess the word correctly or run out of tries.
Below is an example interaction with the game:
Let's play Hangman!
--------
| |
|
|
|
|
-
_____
Please guess a letter or word: p
Good job, p is in the word!
--------
| |
|
|
|
|
-
p_____
Please guess a letter or word: y
Good job, y is in the word!
--------
| |
|
|
|
|
-
py____
Please guess a letter or word: x
x is not in the word.
--------
| |
|
|
|
|
-
py____
...