Skip to content

HaiderNeuralNet/NumberGuessGame

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

🎮 Number Guessing Game

Python Status License


╔═══════════════════════════════════════╗
║        🎯 GUESS THE NUMBER!           ║
║                                       ║
║   🤔  Think of a number 1 to 5...    ║
║   💡  You have 5 attempts             ║
║   🔼  Too High? Try lower!            ║
║   🔽  Too Low?  Try higher!           ║
║   ✅  Correct?  You Win!              ║
╚═══════════════════════════════════════╝

A fun Python CLI game where you guess a random number with hints and attempt tracking!


▶️ How to Run🎮 How to Play📸 Demo👨‍💻 Author


📌 About The Project

A beginner-friendly Python project that demonstrates the use of loops, conditionals, random numbers, and user input — all in one fun game!

The computer secretly picks a random number between 1 and 5. Your job is to guess it in 5 tries or less using hints after each guess.


✨ Features

Feature Description
🎲 Random Number Picks a new number every game
💬 Smart Hints Tells you if guess is too high or too low
🔢 Attempt Counter Tracks how many guesses you've used
⏳ Guess Limit Only 5 chances — don't waste them!
🏆 Win Message Shows how many tries it took to win
❌ Lose Message Reveals the answer if you run out

🛠️ Built With

Python Random Module VS Code


⚙️ How to Run

✅ Requirements

▶️ Run the Game

Step 1 — Clone the repository

git clone https://github.com/HaiderNeuralNet/NumberGuessGame.git

Step 2 — Go into the folder

cd NumberGuessGame

Step 3 — Run the game

python main.py

🎮 How to Play

1. Run the program
2. A random number between 1–5 is chosen secretly
3. Type your guess and press Enter
4. Read the hint:
   🔼 "too high"  → guess a smaller number
   🔽 "too low"   → guess a bigger number
   ✅ "right!"    → you win!
5. You have 5 total attempts
6. If you don't guess it — the answer is revealed!

📸 Demo

🎮 NUMBER GUESSING GAME
━━━━━━━━━━━━━━━━━━━━━━━
enter your guess:
>>> 3
too low
Guesses left: 4
━━━━━━━━━━━━━━━━━━━━━━━
enter your guess:
>>> 4
too low
Guesses left: 3
━━━━━━━━━━━━━━━━━━━━━━━
enter your guess:
>>> 5
✅ right in 3 tries!
━━━━━━━━━━━━━━━━━━━━━━━

📁 Project Structure

📦 NumberGuessGame
 ┣ 📜 main.py        ← main game file
 ┗ 📜 README.md      ← you are here!

🧠 What I Learned

  • ✅ Using Python random module
  • while loops with conditions
  • if / elif / else logic
  • ✅ Taking user input with input()
  • ✅ f-strings for formatted output
  • ✅ Breaking out of loops with break

🔮 Future Improvements

  • Add difficulty levels (Easy / Medium / Hard)
  • Wider number range (1–100)
  • Score leaderboard
  • GUI version with Tkinter
  • Play again option

👨‍💻 Author

Haider Ali Shah BS Artificial Intelligence Student — Pakistan 🇵🇰


GitHub LinkedIn Email


If you liked this project, please give it a star!

Made by Haider Ali Shah

About

A simple command-line number guessing game built with Python. The program picks a random number and gives you 5 chances to guess it!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages