This program is a simple number guessing game implemented in Python. It demonstrates several fundamental programming skills including random number generation, user input handling, loops, and conditional statements.
- Random Number Generation: Uses
random.randint
to generate a random number between 1 and 99. - User Input Handling: Captures user input and converts it to an integer.
- Loops: Utilizes a
while
loop to allow the user to keep guessing until they guess correctly. - Conditional Statements: Uses
if-elif-else
statements to provide feedback on the user's guess and to control the game flow. - String Formatting: Demonstrates the use of f-strings for formatting output messages.
- Ensure you have Python installed on your system.
- Copy the code below into a Python file, for example
guessing_game.py
. - Open your terminal or command prompt.
- Navigate to the directory containing the
guessing_game.py
file. - Run the program by typing
python guessing_game.py
.