A classic number guessing game with difficulty levels, score tracking, and smart hints. Built with Python 3 โ no external dependencies.
- 3 difficulty levels: Easy (1-50), Medium (1-100), Hard (1-200)
- Smart hints: "Way too high/low" when far off, "Too high/low" when close
- Score system: fewer attempts = higher score
- High score tracking across rounds
- Win/loss statistics with win rate
- Play multiple rounds without restarting
# Make sure Python 3.8+ is installed
python --version
# Clone this repository
git clone https://github.com/YOUR-USERNAME/python-number-guessing-game.git
cd python-number-guessing-game
# Run the game
python number_guessing_game.py==================================================
๐ฒ NUMBER GUESSING GAME
Beginnersly.com โ Python Projects
==================================================
๐ฎ Choose Difficulty:
1. Easy (1-50, 10 attempts)
2. Medium (1-100, 7 attempts)
3. Hard (1-200, 5 attempts)
Enter choice (1-3): 2
๐ฏ I'm thinking of a number between 1 and 100.
๐ Difficulty: Medium | Attempts: 7
----------------------------------------
[7 left] Your guess: 50
๐ Too low. Go higher!
[6 left] Your guess: 75
๐ Too high. Go lower!
[5 left] Your guess: 63
๐ CORRECT! The number was 63!
โ
You got it in 3 attempt(s)!
๐ Score: 50 points
๐ NEW HIGH SCORE: 50!
random.randint()โ random number generationwhileloops โ game loop and input validationif/elif/elseโ branching logic for hintstry/exceptโ handling invalid input- f-strings โ formatted output
- Functions โ clean code organization
python-number-guessing-game/
โโโ number_guessing_game.py # Main source code
โโโ README.md # This file
โโโ .gitignore # Git ignore rules
โโโ LICENSE # MIT License
- Save high scores to JSON file (persistence)
- Add multiplayer mode (2 players)
- Add hot/cold hints with colors
- Build Tkinter GUI version
- Add reverse mode (computer guesses YOUR number)
Full tutorial with explanation: Beginnersly.com โ Number Guessing Game
MIT License โ free to use, modify, and share.