Skip to content

xzebcex/Guess-The-Number

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

Guess-The-Number

Description

This is a simple guessing game where the user is asked to guess a number between 1 and 10. The game generates a random number and the user has three chances to guess the number. If the user's guess is too low, the game outputs "Your guess is too low". If the user's guess is too high, the game outputs "Your guess is too high". If the user correctly guesses the number, the game outputs "Good job! You guessed my number in x guesses!", where x is the number of guesses it took the user to correctly guess the number. If the user fails to correctly guess the number in three tries, the game outputs "Nope. The number I was thinking was x", where x is the randomly generated number.

Requirements

• Python 3 • random library

How to run the game

  1. Install Python 3 if not already installed.
  2. Open the terminal or command prompt.
  3. Navigate to the directory where the code is stored.
  4. Type python ‘file-name.py’ in the terminal or command prompt, where "filename" is the name of the code file.
  5. Follow the prompts in the game.

Contributions

This program is a simple script and does not require any contributions.

License

This program is open-sourced and free to use for any purpose.

Author

This program is created by xzebcex.

Conclusion

The code above is a simple number guessing game written in Python. The game generates a random number between 1 and 10, and the player is given three attempts to guess the correct number. If the player's guess is too low or too high, the game informs them. If the player correctly guesses the number, the game will congratulate them and indicate how many attempts it took. If the player is unable to guess the correct number within three attempts, the game will display the correct number.

About

Guess The Number

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages