Jump to content

Featured Replies

Posted

Create an interactive Number Guessing Game that allows the user to guess a randomly generated number within a specified range.


Basic Requirements:

  1. The program should randomly select a number between 1 and 100.

  2. Prompt the user to guess the number.

  3. Provide feedback:

    • "Too high" if the guess is higher than the target number.

    • "Too low" if the guess is lower than the target number.

    • "Correct!" when the guess is right.

  4. Keep track of the number of attempts and display it when the user guesses correctly.

Bonus Features:

  • Allow the user to set their own range (e.g., 1 to 1000).

  • Implement a hints system that gives additional clues, such as whether the number is even or odd.

  • Add an option to play again after the game ends.

Example Output:

Welcome to the Number Guessing Game!
I'm thinking of a number between 1 and 100.

Enter your guess: 50
Too high! Try again.

Enter your guess: 25
Too low! Try again.

Enter your guess: 33
Correct! You guessed it in 3 attempts.
  • Views 78
  • Created
  • Last Reply

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Important Information

Terms of Use Privacy Policy Guidelines We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.