I believe every python beginner codes this number guessing game at least once. If you aren't aware, just give it a try, I have added instructions at the beginning! Some unique things that I have put in are-
- Used random module, to randomize the number to be guessed, so every time you play the game, the number to be guessed is different and random.
- I have added a feature that lets the user choose the difficulty level of the game. I've used if-else and range function for the same.
- Once you finish the game, the programme asks you if you want to try again or exit. Used while loop to add this feature.
- The programme also tells how many attempts are left, I've used simple arithmetic operators for this.
- I have tried my best to handle errors using try and except block, while loop and if-else conditional statements. I have tried to include as many cases as possible.
Please give it a try and let me know what you think!
If there are any doubts, suggestions or bugs you can always ping me on [email protected] !