A simple Hangman word guessing game built with Python.
This project was created as a beginner Python project to practice fundamental programming concepts such as loops, conditions, lists, user input, strings, and the random module.
- ๐ฒ Randomly selects a word from a word list
- โค๏ธ Player starts with 6 lives
- ๐ค Guess the word one letter at a time
- ๐ชฆ Displays Hangman stages based on remaining lives
- โ Keeps track of correctly guessed letters
- โ Prevents losing a life for invalid multi-character input
- ๐ Displays a win or lose message at the end
- Python 3
randommodule
Make sure Python 3 is installed on your computer.
Clone the repository:
git clone https://github.com/Ramtinexe/python-hangman-game.gitNavigate to the project folder:
cd python-hangman-gameRun the program:
python main.py- Run the program.
- The game randomly selects a word.
- Guess the word by entering one letter at a time.
- Correct guesses reveal the letters.
- Incorrect guesses reduce your remaining lives.
- You win when you reveal all the letters.
- You lose when all 6 lives are used.
This project helped me practice:
- Variables
- Lists
- Strings
if,elif, andelseforloopswhileloopsinput()len().lower().append()inandnot inrandom.choice()- f-strings
Possible improvements for future versions:
- Add a larger word list
- Add different word categories
- Add a score system
- Add a replay option
- Add difficulty levels
- Improve input validation
- Add a graphical user interface
Ramtin
This project is part of my journey learning Python and programming.