This is a simple number guessing game implemented in Python. The game selects a random number between 1 and 100, and the player has 10 attempts to guess the correct number. After each guess, the game provides feedback on whether the guessed number is too high or too low.
- Run the script.
- Enter your name when prompted.
- Press Enter to start the game.
- Enter your guess when prompted.
- The game will provide feedback on whether your guess is too high or too low.
- You have 10 attempts to guess the correct number.
The script contains the following main components:
- User Input: The player is prompted to enter their name and start the game.
- Random Number Generation: The script generates a random number between 1 and 100.
- Game Loop: The player is allowed up to 10 attempts to guess the number.
- If the guessed number is too low, the script informs the player that the number is higher.
- If the guessed number is too high, the script informs the player that the number is lower.
- If the guessed number is correct, the script congratulates the player and ends the game.
- If the player exhausts all 10 attempts without guessing correctly, the game ends and prompts the player to restart the program to play again.
- Ensure you have Python 3.x installed on your system.
- Save the script to a file, for example, guess_the_number.py.
- Open a terminal or command prompt.
- Navigate to the directory where the script is saved.
- Run the script.