diff --git a/CONTRIBUTER_INFO.md b/CONTRIBUTER_INFO.md index 574af92..66eac71 100644 --- a/CONTRIBUTER_INFO.md +++ b/CONTRIBUTER_INFO.md @@ -28,3 +28,9 @@ - Collage name : CV Raman
+
+ +- Name : Amrita Kumari +- Collage name : Bharati Vidyapeeth College of Engineering + +
diff --git a/Project-61-Numberguess/Numberguess.py b/Project-61-Numberguess/Numberguess.py new file mode 100644 index 0000000..6ba4b80 --- /dev/null +++ b/Project-61-Numberguess/Numberguess.py @@ -0,0 +1,26 @@ +import random + +def guessing_game(): + # Generate a random number between 1 and 100 + number_to_guess = random.randint(1, 100) + attempts = 0 + print("Welcome to the Number Guessing Game!") + print("I have chosen a number between 1 and 100. Can you guess it?") + + while True: + try: + guess = int(input("Enter your guess: ")) + attempts += 1 + + if guess < number_to_guess: + print("Too low! Try again.") + elif guess > number_to_guess: + print("Too high! Try again.") + else: + print(f"🎉 Congratulations! You guessed the number {number_to_guess} in {attempts} attempts.") + break + except ValueError: + print("Please enter a valid number!") + +# Run the game +guessing_game() diff --git a/Project-61-Numberguess/Readme.md b/Project-61-Numberguess/Readme.md new file mode 100644 index 0000000..e441862 --- /dev/null +++ b/Project-61-Numberguess/Readme.md @@ -0,0 +1,21 @@ +# Number Guessing Game 🎯 + +A simple and fun Python game where the computer randomly selects a number between 1 and 100, and the player has to guess it. + +## Overview +The Number Guessing Game is an interactive console game built using Python. It challenges the player to guess a randomly chosen number within the range of 1 to 100. The game provides hints whether the guess is too low or too high, making it both fun and engaging. + +## Features +- Random number generation between 1 and 100. +- Keeps track of the number of attempts. +- Provides feedback: too low or too high. +- Handles invalid inputs gracefully. +- Simple and beginner-friendly Python code. + +## Installation +1. Make sure you have Python installed. You can download it from [python.org](https://www.python.org/). +2. Clone this repository or download the `guessing_game.py` file. +3. Open your terminal or command prompt in the project directory. + +```bash +git clone