The document outlines the steps to create a Number Guessing Game where players guess a number between 1 and 100. It includes instructions for generating a random number, checking guesses, providing hints, and looping until the correct guess is made. The game concludes by displaying the total number of attempts taken to guess the number correctly.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
3 views3 pages
Project#2 Guessing game'
The document outlines the steps to create a Number Guessing Game where players guess a number between 1 and 100. It includes instructions for generating a random number, checking guesses, providing hints, and looping until the correct guess is made. The game concludes by displaying the total number of attempts taken to guess the number correctly.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3
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.