Picking a random word and checking answers
🚀 Hangman
A beginner-friendly Python program that lets you play Hangman in the terminal against a randomly chosen word.
📚 Table of Contents
🧭 Overview
Day 7 of Udemy's 100 Days of Code™: The Complete Python Pro Bootcamp. The game is built in five steps that follow the course:
- Picking a random word and checking answers (this step)
- Replacing blanks with guesses
- Checking if the player has won
- Keeping track of the player's lives
- Improving the user experience
Step 1: the program picks a random word, asks for one letter and tells you whether the letter is in the word.
📋 Requirements
- Python 3.13 or newer
- No runtime dependencies (the standard library is enough)
pytest(only for running the tests)- Doxygen (optional, to build the API documentation)
🛠️ Setup
Create and activate a local virtual environment named .venv, then install the project in editable mode together with the test extra.
Windows (PowerShell):
python -m venv .venv
.\.venv\Scripts\Activate.ps1
Windows (cmd):
python -m venv .venv
.venv\Scripts\activate.bat
macOS / Linux / Git Bash:
python3 -m venv .venv
source .venv/bin/activate # Git Bash on Windows: source .venv/Scripts/activate
Then install:
python -m pip install --upgrade pip
python -m pip install -e ".[test]"
Run deactivate to leave the environment.
The .env file (access tokens for repository tooling) is ignored by git and is not needed to run the game.
To build the API documentation with Doxygen (output in docs/api):
doxygen Doxyfile
▶️ Run
python -m hangman
or, after installing:
hangman
🧪 Tests
python -m pytest
📄 License
GNU Affero General Public License v3.0 or later (AGPL-3.0-or-later). See LICENSE.