diff --git a/Numbers/Guess The Number Game.py b/Numbers/Guess The Number Game.py new file mode 100644 index 000000000..faabc8ec2 --- /dev/null +++ b/Numbers/Guess The Number Game.py @@ -0,0 +1,14 @@ +import random + +secrect_number = random.randint(1,10) +guess_count = 0 +guess_limit = 3 +while guess_count < guess_limit : + guess = int(input("Enter Your Guess Number : ")) + guess_count +=1 + if guess == secrect_number: + print (" You Won The Game ") + break +else: + print(" Hey You Guess 3 Times.... ") + print(" Try Next Time... ") diff --git a/Numbers/README.md b/Numbers/README.md new file mode 100644 index 000000000..00071d0ae --- /dev/null +++ b/Numbers/README.md @@ -0,0 +1,45 @@ +# Guess The Number + +A simple command-line Python game where the computer selects a random number and the user tries to guess it. + +## Description + +In this game, the program generates a random number within a given range. +The user keeps guessing until the correct number is found. +After each guess, the program tells the user whether the guess is too high or too low. + +This project is suitable for beginners to practice: +- Loops +- Conditionals +- User input +- Random number generation + +## How to Run + +1. Make sure you have Python installed (Python 3.x). +2. Open a terminal in this folder. +3. Run the program using: + +bash +``` +python guess_the_number.py +``` + +# Example : + +text +``` +Guess the number between 1 and 100: +Enter your guess: 50 +Too high! +Enter your guess: 25 +Too low! +Enter your guess: 37 +Correct! You guessed it in 3 attempts. +``` + +# Author +ls_hari prasad + + +