8000 GitHub - gilaniafaq/number-guessing-game: A simple and fun number guessing game built in Python where users try to guess a randomly selected number within a given range and limited number of attempts — based on the chosen difficulty level.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

A simple and fun number guessing game built in Python where users try to guess a randomly selected number within a given range and limited number of attempts — based on the chosen difficulty level.

License

Notifications You must be signed in to change notification settings

gilaniafaq/number-guessing-game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

number-guessing-game

License: MIT Python Version

A simple and fun number guessing game built in Python where users try to guess a randomly selected number within a given range and limited number of attempts — based on the chosen difficulty level. A simple yet engaging command-line number guessing game with adjustable difficulty levels and smart feedback!

Features ✨

  • 3 Difficulty Modes
    Easy (1-20), Medium (1-50), Hard (1-100) with different guess limits
  • Smart Hints 🔍
    Tells you to guess higher/lower after each attempt
  • Input Validation 🛡️
    • 3 invalid input allowance
    • Instant quit option with q
    • Clear error messages
  • Game Statistics 📊
    Shows total attempts and final number at game end

Installation & Play ▶️

  1. Requirements: Python 3.x
  2. Download: Save code as number_guessing_game.py
  3. Run:

python number_guessing_game.py or python3 number 6EBF _guessing_game.py

How to Play 📖

  1. Choose Difficulty

    • Easy (1-20, 5 guesses)
    • Medium (1-50, 7 guesses)
    • Hard (1-100, 6 guesses) Enter 1 for Easy, 2 for Medium, or 3 for Hard:
  2. Guess Smartly

    • You get 5-7 attempts based on difficulty
    • Type numbers between 1 and your mode's maximum
    • Get higher/lower hints after each guess
  3. Special Commands

    • q: Quit anytime
    • Invalid inputs tracked (3 strikes)
  4. Win/Lose Conditions

    • Correct guess within attempts ➡️ Victory! 🏆
    • Exceed guesses/invalid inputs ➡️ Revealed number 😉

Code Structure 🧠

Difficulty Handler

while True: level = input("1/2/3...")

Random Number Generation

num = random.randint(1, max_num)

Core Game Logic

while guess_count < max_guesses: # Input handling with 'q' support # Hints system # Win/lose checks `

Contribute 🤝

Found a bug? Want new features?

  1. Fork the repo
  2. Create your branch
  3. Submit PR!

Made with ❤️ by Syed Afaq Gilani | Try it now and beat the odds! 🚀

About

A simple and fun number guessing game built in Python where users try to guess a randomly selected number within a given range and limited number of attempts — based on the chosen difficulty level.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0