Welcome to the Guess the Number project! In this assignment, you will create a fun game where players guess a randomly generated number.
- The program generates a random number between 1 and 1000.
- The player enters their guess.
- The game gives feedback:
- "Too high!" if the guess is above the number.
- "Too low!" if the guess is below the number.
- "Correct!" if the guess is right.
- If the player guesses correctly before using all 10 chances, the game will congratulate them and ask if they want to play again.
- If the player does not guess the number within 10 chances, the game will inform them that they have lost and ask if they want to play again.
- Write a Python program to implement the game.
- Use the
randommodule to generate a random number. - Handle invalid inputs (like letters or special characters) by prompting the user to enter a valid number.
You can earn a total of 5 points for this project:
- 1 Point: The game works correctly (generates a random number, allows 10 guesses, and provides feedback).
- 1 Point: The program handles invalid input gracefully and has clear instructions for the player.
- 1 Point: The game allows the player to choose to play again after winning or losing.
- 1 Point: The game ends correctly after either winning or losing, providing appropriate messages.
- 1 Point: The code is well-organized and includes comments explaining key parts of the program.
- Submit your Python code as a
.py or.ipynbfile. - Include comments in your code to explain what each part does.
Have fun coding!