Project #2 : Number
Guessing Game Project
Objective:
The player has to guess a number between 1 and 100. The game will provide hints
if the guess is too high or too low.
Steps to Create the Game:
1. Import the Random Module: Use the random module to generate a
random number between 1 and 100.
2. Generate a Random Number: Use random.randint(1, 100) to generate a
random number.
3. User Input: Ask the player to guess the number.
4. Check the Guess: Compare the player's guess to the random number.
o If the guess is too high, print "Too high! Try again."
o If the guess is too low, print "Too low! Try again."
o If the guess is correct, print "Congratulations! You guessed the
number."
5. Loop Until Correct Guess: Use a while loop to keep asking the player for
guesses until they guess correctly.
6. End the Game: Once the player guesses the correct number, the game ends,
and they can see how many attempts it took.
How to Play:
1. Run the Python script.
2. The game will prompt the player to guess a number between 1 and 100.
3. The player keeps guessing until they find the correct number, with the game
providing hints.
4. The game ends when the correct number is guessed, and the total number of
attempts is displayed.