Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Word Guessing Game

A command-line word guessing game (hangman-style) built in Python. Choose a difficulty, guess letters one at a time, and try to reveal the full word before you run out of attempts.

Features

  • Three difficulty levels, each with its own word list and attempt budget
  • Longer, harder words at higher difficulties
  • Letter-by-letter guessing with a live masked view of the word
  • Prevents re-guessing the same letter twice
  • Validates that input is a single alphabetic character
  • Reveals the word on a loss
  • Replay loop, keep playing rounds without restarting the program

Requirements

  • Python 3.10+ (uses match statement)

Usage

Run the game from the command line:

python main.py

You'll be prompted to choose a difficulty, then guess letters one at a time:

Set game difficulty:
1. Easy
2. Medium
3. Advanced
1
Game difficulty set to Easy.
Enter a letter: a
_ _ _ _ _
Enter a letter: p
_ p p _ _
Enter a letter: l
_ p p l _
...
Bingo!
Wanna play again? (y/n):

Difficulty Levels

Option Difficulty Attempts Word Length
1 Easy 15 ~5–8 letters
2 Medium 10 ~7–11 letters
3 Advanced 5 ~10–14 letters

How It Works

  1. Choose a difficulty; this selects both the word pool and how many wrong guesses you're allowed.
  2. A random word is picked from that difficulty's list.
  3. Guess one letter at a time:
    • Correct letters are revealed in place in the masked word.
    • Incorrect letters cost you an attempt.
    • Already-guessed letters are rejected so you don't waste a turn.
  4. Guess every letter in the word before running out of attempts to win.
  5. If you run out of attempts, the full word is revealed.
  6. After each round (win or lose), choose whether to play again — a new random word is picked for each new round.

Error Handling

  • Invalid difficulty: exits with a message if the input isn't a number or isn't one of the listed options.
  • Invalid guess: re-prompts if the input isn't exactly one alphabetic character.
  • Repeated guess: re-prompts without costing an attempt if the letter was already guessed.

Project Structure

.
├── main.py     # Game logic and CLI
├── README.md
└── LICENSE

License

See LICENSE.

About

A command-line word guessing game (hangman-style) built in Python. Choose a difficulty, guess letters one at a time, and try to reveal the full word before you run out of attempts.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages