Create a simple Number Guessing Game in Python.
The Python script Number_Guessing_Game.py
contains a function start_game
that initiates the Number Guessing Game. The game generates a random number between 1 and 100, and the user is prompted to guess the correct number. The script provides feedback on whether the guess is too low or too high and congratulates the user upon a correct guess.
- Ensure you have Python installed on your machine.
- Open a terminal or command prompt.
- Navigate to the directory containing
Number_Guessing_Game.py
. - Run the script using the command:
python Number_Guessing_Game.py
.
Welcome to the Number Guessing Game! I'm thinking of a number between 1 and 100. Can you guess it?
Enter your guess: 50 Too low. Try again.
Enter your guess: 75 Too high. Try again.
Enter your guess: 60 Congratulations! You guessed the correct number 60 in 3 attempts.