Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

1 Commit
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฒ Python Number Guessing Game

A classic number guessing game with difficulty levels, score tracking, and smart hints. Built with Python 3 โ€” no external dependencies.

โœจ Features

  • 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

๐Ÿš€ How to Run

# 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

๐Ÿ“ธ Sample Output

==================================================
  ๐ŸŽฒ 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!

๐Ÿง  Concepts Used

  • random.randint() โ€” random number generation
  • while loops โ€” game loop and input validation
  • if/elif/else โ€” branching logic for hints
  • try/except โ€” handling invalid input
  • f-strings โ€” formatted output
  • Functions โ€” clean code organization

๐Ÿ“ Project Structure

python-number-guessing-game/
โ”œโ”€โ”€ number_guessing_game.py   # Main source code
โ”œโ”€โ”€ README.md                 # This file
โ”œโ”€โ”€ .gitignore                # Git ignore rules
โ””โ”€โ”€ LICENSE                   # MIT License

๐Ÿ’ก Ideas to Extend

  • 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)

๐Ÿ“š Tutorial

Full tutorial with explanation: Beginnersly.com โ€” Number Guessing Game

๐Ÿ“„ License

MIT License โ€” free to use, modify, and share.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages