Welcome to the Hangman Game page.
This page contains a brief description and implementation instructions for the project.
Project Description
The classic word-guessing game. The program randomly selects a secret word (from a list) and the player guesses one letter at a time. Correct guesses reveal letters in the word; incorrect guesses add to a hangman drawing. The player wins by guessing all letters before running out of attempts.
Project Requirements
Python 3.x (built-in random
module for word selection).
How to Run the Project
- Create a script (e.g.
hangman.py
) that reads a word list or hardcodes words. Userandom.choice()
to pick a secret word. - Run it:
python hangman.py
. The game will print blanks for letters and prompt the user for a letter each turn. - Continue until the word is guessed or the maximum misses (e.g. 6) is reached.
Key Concepts Learned
- Lists: To track correctly guessed letters and missed letters.
- Loops & Conditionals:
while
loop for game turns, andif
statements to check win/loss conditions. - User Input: Validating that input is a single letter and checking if it was already guessed.
- Random Selection: Choosing the word randomly.
Possible Extensions
- Use a bigger word list or fetch words online.
- Draw the hangman in ASCII art.
- Allow the player to save/quit mid-game and resume.
- Add difficulty levels (longer words for higher difficulty).